summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2025-08-15 08:24:06 -0700
committerGitHub <noreply@github.com>2025-08-15 15:24:06 +0000
commitf75bf474ef87737c87ef6dcb431bd0b87faee0a8 (patch)
tree14ed00217409b67316311ddbf09e072ee6ecdc83 /source
parentfeb1569d972f294ce482ea8b1645da6cde4e982d (diff)
[CUDA] Fix incorrect `kIROp_RaytracingAccelerationStructureType` emitting logic (#8168)
Fixes: #8167 Current emitting logic does not work, this has been corrected. The provided test ensures our CUDA code is valid by compiling PTX from it. `m_writer->emit("OptixTraversableHandle");` should be `out <<` since `out` adds to type-name-cache; otherwise using a type twice will produce bad type-names (since we filled type-name cache with "" instead of "typeName")
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-emit-cuda.cpp17
-rw-r--r--source/slang/slang-intrinsic-expand.cpp2
2 files changed, 2 insertions, 17 deletions
diff --git a/source/slang/slang-emit-cuda.cpp b/source/slang/slang-emit-cuda.cpp
index e27fd25aa..a5b90740d 100644
--- a/source/slang/slang-emit-cuda.cpp
+++ b/source/slang/slang-emit-cuda.cpp
@@ -214,6 +214,7 @@ SlangResult CUDASourceEmitter::calcTypeName(IRType* type, CodeGenTarget target,
out << "TensorView";
return SLANG_OK;
}
+ case kIROp_RaytracingAccelerationStructureType:
case kIROp_HitObjectType:
{
out << "OptixTraversableHandle";
@@ -254,22 +255,6 @@ SlangResult CUDASourceEmitter::calcTypeName(IRType* type, CodeGenTarget target,
}
}
- if (auto untypedBufferType = as<IRUntypedBufferResourceType>(type))
- {
- switch (untypedBufferType->getOp())
- {
- case kIROp_RaytracingAccelerationStructureType:
- {
- m_writer->emit("OptixTraversableHandle");
- return SLANG_OK;
- break;
- }
-
- default:
- break;
- }
- }
-
return Super::calcTypeName(type, target, out);
}
diff --git a/source/slang/slang-intrinsic-expand.cpp b/source/slang/slang-intrinsic-expand.cpp
index 56ff2a108..28023e9e2 100644
--- a/source/slang/slang-intrinsic-expand.cpp
+++ b/source/slang/slang-intrinsic-expand.cpp
@@ -446,7 +446,7 @@ const char* IntrinsicExpandContext::_emitSpecial(const char* cursor)
// there is a format conversion required between the type associated by the resource and
// the backing ImageFormat. Currently this is only implemented on CUDA, where there are
// specialized versions of the RWTexture writes that will do a format conversion.
- if (m_emitter->getTarget() == CodeGenTarget::CUDASource)
+ if (isCUDATarget(m_emitter->getTargetReq()))
{
IRInst* resourceInst = m_callInst->getArg(0);