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

Avoid promition to Int32 in work_items functions #287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Mar 5, 2025

The dimindx-1 would cause a promotion to Int64 and then a checked_trunc to UInt32.

;  @ /home/vchuravy/.julia/packages/SPIRVIntrinsics/ekvif/src/work_item.jl:16 within `#get_global_id`
define internal fastcc void @julia__get_global_id_13605(i32 zeroext %0) unnamed_addr !dbg !214 {
top:
; ┌ @ /home/vchuravy/.julia/packages/SPIRVIntrinsics/ekvif/src/utils.jl:80 within `macro expansion` @ /home/vchuravy/.julia/packages/LLVM/b3kFs/src/interop/pointer.jl:350
; │┌ @ int.jl:1011 within `-`
; ││┌ @ int.jl:551 within `rem`
; │││┌ @ number.jl:7 within `convert`
; ││││┌ @ boot.jl:892 within `Int64`
; │││││┌ @ boot.jl:816 within `toInt64`
        %1 = zext i32 %0 to i64, !dbg !215
; ││└└└└
; ││ @ int.jl:1013 within `-` @ int.jl:86
    %2 = add nsw i64 %1, -1, !dbg !232
; │└
; │ @ /home/vchuravy/.julia/packages/SPIRVIntrinsics/ekvif/src/utils.jl:80 within `macro expansion` @ /home/vchuravy/.julia/packages/LLVM/b3kFs/src/interop/pointer.jl:344
; │┌ @ essentials.jl:687 within `cconvert`
; ││┌ @ number.jl:7 within `convert`
; │││┌ @ boot.jl:896 within `UInt32`
; ││││┌ @ boot.jl:856 within `toUInt32`
; │││││┌ @ boot.jl:772 within `checked_trunc_uint`
        %3 = icmp ugt i64 %2, 4294967295, !dbg !234
        br i1 %3, label %L9, label %L15, !dbg !234

L9:                                               ; preds = %top
        call fastcc void @julia__throw_inexacterror_13622() #4, !dbg !234
        unreachable, !dbg !234

L15:                                              ; preds = %top
; ││││││ @ boot.jl:770 within `checked_trunc_uint`
        %4 = trunc i64 %2 to i32, !dbg !244
; │└└└└└
; │┌ @ /home/vchuravy/.julia/packages/LLVM/b3kFs/src/interop/pointer.jl:182 within `_typed_llvmcall`
; ││┌ @ /home/vchuravy/.julia/packages/LLVM/b3kFs/src/interop/pointer.jl:182 within `macro expansion` @ /home/vchuravy/.julia/packages/LLVM/b3kFs/src/interop/base.jl:39
     %5 = call i64 @_Z13get_global_idj(i32 %4), !dbg !245
; └└└
; ┌ @ int.jl:87 within `+`
   %6 = add i64 %5, 1, !dbg !250
   ret void, !dbg !250
; └
}

Copy link

github-actions bot commented Mar 5, 2025

Your PR no longer requires formatting changes. Thank you for your contribution!

Copy link

codecov bot commented Mar 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.31%. Comparing base (bd6c0c5) to head (be2ea07).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #287      +/-   ##
==========================================
- Coverage   71.47%   71.31%   -0.17%     
==========================================
  Files          12       12              
  Lines         610      610              
==========================================
- Hits          436      435       -1     
- Misses        174      175       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +11 to +15
# TODO: upstream this
struct Literal{T} end
Base.:(*)(x::Number, ::Type{Literal{T}}) where {T} = T(x)
const i32 = Literal{Int32}
const u32 = Literal{UInt32}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something for in GPUToolbox.jl?

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

Successfully merging this pull request may close these issues.

2 participants