Skip to content

Commit 29f1484

Browse files
authored
build: small fixups for LLVM 21 support (#2034)
Signed-off-by: Alex Fuller <[email protected]>
1 parent e9a8ec5 commit 29f1484

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/liboslexec/llvm_instance.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,11 @@ BackendLLVM::run()
21162116
// for NVPTX (https://www.llvm.org/docs/NVPTXUsage.html#triples).
21172117
ll.module()->setDataLayout(
21182118
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
2119+
# if OSL_LLVM_VERSION < 210
21192120
ll.module()->setTargetTriple("nvptx64-nvidia-cuda");
2121+
# else
2122+
ll.module()->setTargetTriple(llvm::Triple("nvptx64-nvidia-cuda"));
2123+
# endif
21202124
}
21212125
# endif
21222126
#else
@@ -2181,7 +2185,12 @@ BackendLLVM::run()
21812185

21822186
shadeops_module->setDataLayout(
21832187
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
2188+
# if OSL_LLVM_VERSION < 210
21842189
shadeops_module->setTargetTriple("nvptx64-nvidia-cuda");
2190+
# else
2191+
shadeops_module->setTargetTriple(
2192+
llvm::Triple("nvptx64-nvidia-cuda"));
2193+
# endif
21852194

21862195
std::unique_ptr<llvm::Module> shadeops_ptr(shadeops_module);
21872196
llvm::Linker::linkModules(*ll.module(), std::move(shadeops_ptr),
@@ -2208,7 +2217,12 @@ BackendLLVM::run()
22082217

22092218
rend_lib_module->setDataLayout(
22102219
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
2220+
# if OSL_LLVM_VERSION < 210
22112221
rend_lib_module->setTargetTriple("nvptx64-nvidia-cuda");
2222+
# else
2223+
rend_lib_module->setTargetTriple(
2224+
llvm::Triple("nvptx64-nvidia-cuda"));
2225+
# endif
22122226

22132227
for (llvm::Function& fn : *rend_lib_module) {
22142228
fn.addFnAttr("osl-rend_lib-function", "true");

0 commit comments

Comments
 (0)