summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-08-01 15:39:28 -0400
committerGitHub <noreply@github.com>2023-08-01 15:39:28 -0400
commit1653731718e75c297730dfb878e9f23895d1051d (patch)
tree76f05056594f9910e5baf464b05a41e48398fe18 /source/compiler-core
parentedcc50cdcaf3743d4140b439375d0d40e3a941f7 (diff)
Fix literals needing cast (#3039)
* Cast integer literals. * Fix expected output. * For CUDA, search global instructions to see what types are used. Improve lookup for fp16 header in CUDA. * Fix issue with f16tof32 * Small improvement around finding used base types.
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-nvrtc-compiler.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/source/compiler-core/slang-nvrtc-compiler.cpp b/source/compiler-core/slang-nvrtc-compiler.cpp
index c756955ec..daa392120 100644
--- a/source/compiler-core/slang-nvrtc-compiler.cpp
+++ b/source/compiler-core/slang-nvrtc-compiler.cpp
@@ -628,11 +628,35 @@ SlangResult NVRTCDownstreamCompiler::_findIncludePath(String& outPath)
String libPath = SharedLibraryUtils::getSharedLibraryFileName((void*)m_nvrtcCreateProgram);
if (libPath.getLength())
{
- const String parentPath = Path::getParentDirectory(libPath);
+ String parentPath = Path::getParentDirectory(libPath);
+
if (SLANG_SUCCEEDED(_findFileInIncludePath(parentPath, g_fp16HeaderName, outPath)))
{
return SLANG_OK;
}
+
+ // See if the shared library is in the SDK, as if so we know how to find the includes
+ // TODO(JS):
+ // This directory structure is correct for windows perhaps could be different elsewhere.
+ {
+ List<UnownedStringSlice> pathSlices;
+ Path::split(parentPath.getUnownedSlice(), pathSlices);
+
+ // This -2 split holds the version number.
+ const auto pathSplitCount = pathSlices.getCount();
+ if (pathSplitCount >= 3 &&
+ pathSlices[pathSplitCount - 1] == toSlice("bin") &&
+ pathSlices[pathSplitCount - 3] == toSlice("CUDA"))
+ {
+ // We want to make sure that one of these paths is CUDA...
+ const auto sdkPath = Path::getParentDirectory(parentPath);
+
+ if (SLANG_SUCCEEDED(_findFileInIncludePath(sdkPath, g_fp16HeaderName, outPath)))
+ {
+ return SLANG_OK;
+ }
+ }
+ }
}
}