summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit-cpp.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-10-05 11:10:53 -0700
committerGitHub <noreply@github.com>2020-10-05 11:10:53 -0700
commit41d8610653cacfb763e3e1a1c538e17037703108 (patch)
tree4f9b0c9c7e46a47feac40ecfa6b6b3a9cb027921 /source/slang/slang-emit-cpp.cpp
parentd930c65e7fef6414af363e1f8d4fff52beb448af (diff)
Small fixes for CUDA code emit (#1564)
* Small fixes for CUDA code emit * Add a CUDA translation to `GroupMemoryBarrierWithWaveSync()`. We map this to `__syncwarp()` for CUDA (with no mask, implying a full-warp sync). * Consistently use `SLANG_PRELUDE_ASSERT` for assertions introduced in code emit (rather than just using the bare `assert(...)` function, which is not included by our CUDA prelude by default) * Add a new `SLANG_CUDA_STRUCTURED_BUFFER_NO_COUNT` flag to the CUDA prelude that allows the `count` field to be omitted from `(RW)StructuredBuffer<T>`. This is a bit of a hacky because the computed layouts will still assume the `count` field is present, but this feature is required by at least one client application for now. A better long-term fix will take more time to design and implement. * fixup: CUDA prelude code fix for pedantic compilers Co-authored-by: Tim Foley <tim.foley.is@gmail.com> Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-emit-cpp.cpp')
-rw-r--r--source/slang/slang-emit-cpp.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index 5359740b4..1e2482bb5 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -984,7 +984,7 @@ void CPPSourceEmitter::_emitGetAtDefinition(const UnownedStringSlice& funcName,
{
int vecSize = int(getIntVal(vectorType->getElementCount()));
- writer->emit("assert(b >= 0 && b < ");
+ writer->emit("SLANG_PRELUDE_ASSERT(b >= 0 && b < ");
writer->emit(vecSize);
writer->emit(");\n");
if (lValue)
@@ -997,7 +997,7 @@ void CPPSourceEmitter::_emitGetAtDefinition(const UnownedStringSlice& funcName,
//int colCount = int(getIntVal(matrixType->getColumnCount()));
int rowCount = int(getIntVal(matrixType->getRowCount()));
- writer->emit("assert(b >= 0 && b < ");
+ writer->emit("SLANG_PRELUDE_ASSERT(b >= 0 && b < ");
writer->emit(rowCount);
writer->emit(");\n");