Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to determine the maximum grid size? #817

Open
MrOlegus opened this issue Mar 28, 2023 · 1 comment
Open

How to determine the maximum grid size? #817

MrOlegus opened this issue Mar 28, 2023 · 1 comment

Comments

@MrOlegus
Copy link

What is wrong?

const gpu = new GPU();
const multiplyMatrix = gpu.createKernel(function(a, b) {
    let sum = 0;
    for (let i = 0; i < 512; i++) {
        sum += a[this.thread.y][i] * b[i][this.thread.x];
    }
    return sum;
}).setOutput([512, 512]);

const c = multiplyMatrix(a, b);

I am using your example for matrix multiplication. For 512x512 everything is ok, but at 1024x1024 I get it.
Снимок

Where does it happen?

All the time.

How do we replicate the issue?

const gpu = new GPU();
const multiplyMatrix = gpu.createKernel(function(a, b) {
    let sum = 0;
    for (let i = 0; i < 1000000; i++) {
        sum += a[this.thread.y][i] * b[i][this.thread.x];
    }
    return sum;
}).setOutput([1000000, 1000000]);

const c = multiplyMatrix(a, b);

How important is this (1-5)?

3

Expected behavior (i.e. solution)

Throwing an out-of-memory error instead of trying to execute.

Other Comments

@jacobbogers
Copy link

jacobbogers commented Dec 21, 2023

you can ask limits from webgl for example

var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);

ofc a superduper card is going to have a higher limit then (lets say) your feature phone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants