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

Device-side broadcast regression on 1.5 #350

Closed
marius311 opened this issue Aug 5, 2020 · 3 comments
Closed

Device-side broadcast regression on 1.5 #350

marius311 opened this issue Aug 5, 2020 · 3 comments
Labels
regression Something that used to work, doesn't anymore.

Comments

@marius311
Copy link
Contributor

The following works with CUDA 1.2.1 and Julia 1.4 but errors on 1.5:

using CUDA

function foo(I,M)
    M[2I:2I+1] .= (1,2)
end

function bar(M)
    foo(1,M)
    nothing
end

M = CuVector{Cint}(undef, 4)
@cuda bar(M)
ERROR: LoadError: InvalidIRError: compiling kernel bar(CuDeviceArray{Int32,1,CUDA.AS.Global}) resulted in invalid LLVM IR
Reason: unsupported call through a literal pointer (call to jl_alloc_string)
Stacktrace:
 [1] _string_n at strings/string.jl:60
 [2] StringVector at iobuffer.jl:31
 [3] #IOBuffer#331 at iobuffer.jl:114
 [4] print_to_string at strings/io.jl:133
 [5] string at strings/io.jl:174
 [6] throwdm at broadcast.jl:1008
 [7] copyto! at broadcast.jl:922
 [8] copyto! at broadcast.jl:886
 [9] materialize! at broadcast.jl:848
 [10] materialize! at broadcast.jl:845
 [11] foo at Untitled-1:46
 [12] bar at Untitled-1:50
Manifest.toml

  [621f4979] AbstractFFTs v0.5.0
  [79e6a3ab] Adapt v2.0.2
  [b99e7846] BinaryProvider v0.5.10
  [fa961155] CEnum v0.4.1
  [052768ef] CUDA v1.2.1
  [864edb3b] DataStructures v0.17.20
  [e2ba6199] ExprTools v0.1.1
  [0c68f7d7] GPUArrays v5.0.0
  [61eb1bfa] GPUCompiler v0.5.5
  [929cbde3] LLVM v2.0.0
  [1914dd2f] MacroTools v0.5.5
  [872c559c] NNlib v0.7.4
  [bac558e1] OrderedCollections v1.3.0
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.0.1
  [a759f4b9] TimerOutputs v0.5.6

@marius311 marius311 added the bug Something isn't working label Aug 5, 2020
@maleadt maleadt changed the title Invalid IR regression on 1.5 Device-side broadcast regression on 1.5 Aug 6, 2020
@maleadt
Copy link
Member

maleadt commented Aug 6, 2020

Device-side broadcast isn't really well-supported / tested.

@maleadt maleadt added regression Something that used to work, doesn't anymore. and removed bug Something isn't working labels Aug 6, 2020
marius311 added a commit to marius311/CMBLensing.jl that referenced this issue Aug 6, 2020
@maleadt
Copy link
Member

maleadt commented Aug 25, 2020

This looks like an inference change in the throwdm method, which we can't easily override or work around. Since device-side broadcast generally doesn't work, I don't feel like redefining the entire broadcast machinery to get rid of that specific error...

@maleadt maleadt closed this as completed Aug 25, 2020
@marius311
Copy link
Contributor Author

For posterity, a solution I found (mentioned on Slack) was to replace the broadcast

M[2I:2I+1] .= (1,2)

with

M[2I:2I+1] .= @SVector[1,2]

Understandable not to want to mess with it esp. since it has workarounds, but IMO its a pretty convenient feature to have, so if an easy path to get it back in the future presented itself, I think it'd be worth doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something that used to work, doesn't anymore.
Projects
None yet
Development

No branches or pull requests

2 participants