Skip to content

Commit 7ed2dc6

Browse files
committed
CI
1 parent 768b61a commit 7ed2dc6

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/CodeGen_D3D12Compute_Dev.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,19 @@ string CodeGen_D3D12Compute_Dev::CodeGen_D3D12Compute_C::print_storage_type(Type
317317
return print_type_maybe_storage(type, true, DoNotAppendSpace);
318318
}
319319

320+
// Return the HLSL bit-reinterpret intrinsic name for a given type.
321+
// At SM 6.2+, 16-bit types use asfloat16/asint16/asuint16.
322+
// At SM 5.1, only the 32-bit variants (asfloat/asint/asuint) exist.
323+
string hlsl_reinterpret_name(Type t) {
324+
if (t.is_float()) {
325+
return t.bits() == 16 ? "asfloat16" : "asfloat";
326+
}
327+
if (t.bits() == 16) {
328+
return t.is_int() ? "asint16" : "asuint16";
329+
}
330+
return t.is_int() ? "asint" : "asuint";
331+
}
332+
320333
string CodeGen_D3D12Compute_Dev::CodeGen_D3D12Compute_C::print_reinterpret(Type type, const Expr &e) {
321334
if (type == e.type()) {
322335
return print_expr(e);
@@ -626,20 +639,6 @@ string hex_literal(T value) {
626639
return hex.str();
627640
}
628641

629-
// Return the HLSL bit-reinterpret intrinsic name for a given type.
630-
// These names are fixed regardless of SM level (legacy aliases always work).
631-
string hlsl_reinterpret_name(Type t) {
632-
if (t.is_float()) {
633-
return t.bits() == 16 ? "asfloat16" : "asfloat";
634-
}
635-
// 16-bit integer variants (asuint16/asint16) require SM 6.2+, but that is
636-
// the same requirement as using float16_t/uint16_t scalars at all.
637-
if (t.bits() == 16) {
638-
return t.is_int() ? "asint16" : "asuint16";
639-
}
640-
return t.is_int() ? "asint" : "asuint";
641-
}
642-
643642
} // namespace
644643

645644
struct StoragePackUnpack {

0 commit comments

Comments
 (0)