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

delta function for CI was not type-stable #51

Merged
merged 1 commit into from
May 2, 2023

Conversation

b-fg
Copy link
Collaborator

@b-fg b-fg commented May 2, 2023

I noticed that @inline had to be used in

@inline δ(i,N::Int) = CI(ntuple(j -> j==i ? 1 : 0, N))

for the GPU code to compile, differently from CPU where this was not needed.
I rose this issue JuliaGPU/KernelAbstractions.jl#392 and it was pointed out that δ(d,I::CartesianIndex{N}) was type-unstable. This fix makes it type-stable.

…be used for GPU executions, otherwise the code could not compile.

This fix makes delta type stable and there is no need to inline the function.
No noticeable performance change.
@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

Merging #51 (614a545) into master (31114ad) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #51   +/-   ##
=======================================
  Coverage   93.71%   93.71%           
=======================================
  Files           8        8           
  Lines         382      382           
=======================================
  Hits          358      358           
  Misses         24       24           
Impacted Files Coverage Δ
src/util.jl 84.37% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@weymouth weymouth merged commit af00631 into weymouth:master May 2, 2023
8 checks passed
@weymouth
Copy link
Owner

weymouth commented May 2, 2023

How surprising. Are there other places where this is the case where we should be using Val?

@b-fg
Copy link
Collaborator Author

b-fg commented May 2, 2023

Not sure really... I caught this one by chance when writing the blog post. Since it seems @inline makes it work and it is used quite a lot throughout the code it would be tedious to check one at a time... :/

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.

None yet

2 participants