Skip to content

Usage of ::Int #685

Description

@AntonReinhard

I'm not sure if this is intentional, I assume it's to follow the general Julia default of Int, which is Int64 on most platforms. However, it also means I am unable to use Int32 when I specifically want to, and on GPUs it can actually make quite a difference especially for indexing or iterating.
As it stands, I cannot start a kernel with Int32 block sizes, for example:

  Expression: binning_vegas!(backend, bins_buffer, ndi_buffer, buffer, grid, normal_distribution)
  MethodError: no method matching KernelAbstractions.NDIteration.StaticSize(::Tuple{Int32, Int32, Int32})
  The type `KernelAbstractions.NDIteration.StaticSize` exists, but no method is defined for this combination of argument types when trying to construct it.
  
  Closest candidates are:
    KernelAbstractions.NDIteration.StaticSize(::Int64...)
     @ KernelAbstractions ~/.julia/packages/KernelAbstractions/aLmvZ/src/nditeration.jl:21
    KernelAbstractions.NDIteration.StaticSize(::Tuple{Vararg{Int64}})
     @ KernelAbstractions ~/.julia/packages/KernelAbstractions/aLmvZ/src/nditeration.jl:20
    KernelAbstractions.NDIteration.StaticSize(::Type{<:Tuple})
     @ KernelAbstractions ~/.julia/packages/KernelAbstractions/aLmvZ/src/nditeration.jl:22
  
  Stacktrace:
   [1] vegas_binning_kernel_batched!(dev::CPU, size::Tuple{Int32, Int32, Int32})
     @ Vegas ~/.julia/packages/KernelAbstractions/aLmvZ/src/macros.jl:68
   [2] binning_vegas!(backend::CPU, bins_buffer::Matrix{Float16}, ndi_buffer::Matrix{Int64}, buffer::VegasBatchBuffer{Float16, 4194304, 11, Matrix{Float16}, Vector{Float16}, Vector{Float16}}, grid::VegasGrid{Float16, 33, 11, Matrix{Float16}}, func::Function)
     @ Vegas ~/repos/Vegas.jl/src/binning.jl:169
   [3] macro expansion
     @ ~/repos/Vegas.jl/test/binning.jl:21 [inlined]
   [4] macro expansion
     @ ~/.julia/juliaup/julia-1.12.5+0.x64.linux.gnu/share/julia/stdlib/v1.12/Test/src/Test.jl:677 [inlined]
   [5] macro expansion
     @ ~/repos/Vegas.jl/test/binning.jl:21 [inlined]
   [6] macro expansion
     @ ~/.julia/juliaup/julia-1.12.5+0.x64.linux.gnu/share/julia/stdlib/v1.12/Test/src/Test.jl:1865 [inlined]
   [7] testsuite_binning(backend::CPU, el_type::Type{Float16}, nbins::Int64, dim::Int64)
     @ Main ~/repos/Vegas.jl/test/binning.jl:10

I think I could make a PR to make this more generic by using Integer instead of Int in most places.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions