cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

[API] `s[op].bind` for block & thread binding for OpenCL/CUDA targets #448

Open hecmay opened 2 years ago

hecmay commented 2 years ago

TBA

hecmay commented 2 years ago

vector-add example to map loops after hcl.split to specific thread and block axes

    def kernel(A, B):
        C = hcl.compute((256,), lambda i: A[i] + B[i], "C")
        return C

    bx, tx = s[kernel.C].split(kernel.C.axis[0], factor=64)
    s[kernel.C].bind(bx, hcl.BlockIdx.x)
    s[kernel.C].bind(tx, hcl.ThreadIdx.x)