Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CUDACore/src/library_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ end
C_64I = 25 # complex as a pair of signed 64-bit int numbers
R_64U = 26 # real as a unsigned 64-bit int
C_64U = 27 # complex as a pair of unsigned 64-bit int numbers
R_8F_E4M3 = 28 # real as a nv_fp8_e4m3
R_8F_E5M2 = 29 # real as a nv_fp8_e5m2
R_8F_UE8M0 = 30 # real as an exponent-only unsigned nv_fp8_e8m0
R_6F_E2M3 = 31 # real as a nv_fp6_e2m3
R_6F_E3M2 = 32 # real as a nv_fp6_e3m2
R_4F_E2M1 = 33 # real as a nv_fp4_e2m1
end

const R_8F_UE4M3 = R_8F_E4M3 # real as an unsigned nv_fp8_e4m3

function Base.convert(::Type{cudaDataType}, T::DataType)
if T === Float16
return R_16F
Expand Down
6 changes: 6 additions & 0 deletions test/core/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ end
end
@test_throws ArgumentError convert(CUDACore.cudaDataType, BigFloat)
@test_throws ArgumentError Type(CUDACore.R_4I) # adjust once we support 4-bit Ints
# narrow-precision floats: enum members exist,
# but no Julia type maps to them in CUDACore.
for c_type in (CUDACore.R_8F_E4M3, CUDACore.R_8F_E5M2, CUDACore.R_8F_UE8M0,
CUDACore.R_6F_E2M3, CUDACore.R_6F_E3M2, CUDACore.R_4F_E2M1)
@test_throws ArgumentError Type(c_type)
end
end