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

Specified a vector size of 3 but function signature generated a vector size of 4 #922

Closed
nkoskelo opened this issue Feb 20, 2025 · 0 comments

Comments

@nkoskelo
Copy link
Contributor

import numpy as np
import loopy as lp
import pyopencl as cl

ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)

n = 3**4
a = 2
b = 5

knl = lp.make_kernel(
     "{ [i]: 0<=i<n }",
     """
     out[i] = a if i == 0 else b
     """
)
vec_size = 3
knl = lp.split_array_axis(knl, "out", 0, vec_size)
knl = lp.split_iname(knl, "i", vec_size)
knl = lp.tag_inames(knl, {"i_inner": "vec"})
knl = lp.tag_array_axes(knl, "out", "c,vec")
knl = lp.set_options(knl, write_code=True)
knl = lp.assume(knl, f"n % {vec_size} = 0 and n>0")

knl = lp.add_and_infer_dtypes(knl, {"a": np.dtype(np.float32), "b": np.dtype(np.float32)})

device_code = lp.generate_code_v2(knl).device_code()

assert "float3" in device_code

Instead of float3 you will get float4

inducer added a commit that referenced this issue Feb 20, 2025
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

1 participant