diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-06-10 14:57:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-10 11:57:09 -0700 |
| commit | 37e8917d10626b519470f2e34625f0efe741352f (patch) | |
| tree | 4e8e51bd63ebc03fcdf0c893b675906cf507d73c /source/slang/slang-intrinsic-expand.cpp | |
| parent | 0d9bd79e8fd4d57e1a723ca6b6a45efec2b42872 (diff) | |
CUDA layout corner cases/testing (#1881)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Add support for sizeOf/alignOf/offsetOf to stdlib.
Add $G intrinsic expansion that works of the generic parameters not the param type
* Test cuda layout.
* Fix CUDA layout issues.
Fix reflection to handle other built in types.
Fix __offsetOf
* Tests of reflection and layout as reported directly from CUDA.
* Comment about use of aligned size as size.
* Fix warning from VS.
* Check alignment is pow2.
* Small improvements to alignment calcs.
* Tab to spaces.
* Fix alignment pointer sizes on 32 bit OS for CUDA.
* Fix CUDA reflection on 32 bit.
Diffstat (limited to 'source/slang/slang-intrinsic-expand.cpp')
| -rw-r--r-- | source/slang/slang-intrinsic-expand.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/slang/slang-intrinsic-expand.cpp b/source/slang/slang-intrinsic-expand.cpp index bd2e17b28..045b7e6c5 100644 --- a/source/slang/slang-intrinsic-expand.cpp +++ b/source/slang/slang-intrinsic-expand.cpp @@ -236,6 +236,35 @@ const char* IntrinsicExpandContext::_emitSpecial(const char* cursor) } break; + case 'G': + { + // Get the type/value at the index of the specialization of this generic + + SLANG_RELEASE_ASSERT(*cursor >= '0' && *cursor <= '9'); + Index argIndex = (*cursor++) - '0'; + + IRSpecialize* specialize = as<IRSpecialize>(m_callInst->getCallee()); + SLANG_ASSERT(specialize); + + { + auto argCount = Index(specialize->getArgCount()); + SLANG_UNUSED(argCount); + SLANG_ASSERT(argIndex < argCount); + + auto arg = specialize->getArg(argIndex); + + if (auto type = as<IRType>(arg)) + { + m_emitter->emitType(type); + } + else + { + m_emitter->emitVal(arg, getInfo(EmitOp::General)); + } + } + } + break; + case 'T': // Get the the 'element' type for the type of the param at the index { |
