-
Notifications
You must be signed in to change notification settings - Fork 213
Uint fix #123
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
base: main
Are you sure you want to change the base?
Uint fix #123
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Could you pixi run format to fix the formatting please?
yep, my bad! thank you.. fixed it |
|
Also while going through the puzzles myself.. fn process_sliding_window(
output: LayoutTensor[mut=True, dtype, vector_layout],
a: LayoutTensor[mut=False, dtype, vector_layout],
):
thread_id = thread_idx.x
# Each thread processes a sliding window of 3 elements
window_sum = Scalar[dtype](0.0)
# Sum elements in sliding window: [i-1, i, i+1]
for offset in range(ITER):
idx = thread_id + offset - 1
if 0 <= idx < SIZE:
value = rebind[Scalar[dtype]](a[idx])
window_sum += value
output[thread_id] = window_sum
Output [Thread 0x7fffa57fa640 (LWP 1345974) exited]
/home/raju/personal/mojo-gpu-puzzles/problems/p09/p09.mojo:41:27: warning: deprecated implicit conversion from 'Int' to 'UInt'
idx = thread_id + offset - 1
^~~~~~
/home/raju/personal/mojo-gpu-puzzles/problems/p09/p09.mojo:1:1: note: '@implicit' constructor 'UInt.__init__' declared here
from memory import UnsafePointerThis particular case I have converted locally by type casting like below, but not in this commit fn process_sliding_window(
output: LayoutTensor[mut=True, dtype, vector_layout],
a: LayoutTensor[mut=False, dtype, vector_layout],
):
thread_id = thread_idx.x
# Each thread processes a sliding window of 3 elements
window_sum = Scalar[dtype](0.0)
# Sum elements in sliding window: [i-1, i, i+1]
for offset in range(ITER):
idx = thread_id + UInt(offset) - 1
if 0 <= idx < SIZE:
value = rebind[Scalar[dtype]](a[idx])
window_sum += value
output[thread_id] = window_sumso was wondering are there any pointers as to when is the deprecation warning getting triggered as such. |
|
Right! I think completely resolving it would require some manual type conversions. In the case above, it will be for offset in range(ITER):
idx = thread_id + UInt(offset) - 1
if 0 <= Int(idx) < SIZE:Because, |
Changed occurrences of Int to UInt to prevent deprecation warnings mentioned in #119
Please let me know if this is inline with the suggested changes.
Thanks!