Skip to content

Commit

Permalink
Fix OptiX data layout mismatch with LLVM 16+
Browse files Browse the repository at this point in the history
i128:128 was already in the NVPTX backend since LLVM 6, the docs
this was taken from seem outdated. Unclear it started failing now,
but the data layout seems clearly incomplete without this.

Signed-off-by: Brecht Van Lommel <[email protected]>
  • Loading branch information
brechtvl committed Sep 28, 2023
1 parent c8e684e commit dee0540
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/liboslexec/llvm_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ BackendLLVM::run()
// The target triple and data layout used here are those specified
// for NVPTX (https://www.llvm.org/docs/NVPTXUsage.html#triples).
ll.module()->setDataLayout(
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
"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");
ll.module()->setTargetTriple("nvptx64-nvidia-cuda");
}
# endif
Expand Down Expand Up @@ -1813,7 +1813,7 @@ BackendLLVM::run()
err);

shadeops_module->setDataLayout(
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
"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");
shadeops_module->setTargetTriple("nvptx64-nvidia-cuda");

std::unique_ptr<llvm::Module> shadeops_ptr(shadeops_module);
Expand All @@ -1840,7 +1840,7 @@ BackendLLVM::run()
err);

rend_lib_module->setDataLayout(
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
"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");
rend_lib_module->setTargetTriple("nvptx64-nvidia-cuda");

for (llvm::Function& fn : *rend_lib_module) {
Expand All @@ -1860,7 +1860,7 @@ BackendLLVM::run()
// See: https://llvm.org/docs/NVPTXUsage.html
ll.module()->setTargetTriple("nvptx64-nvidia-cuda");
ll.module()->setDataLayout(
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64");
"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");

// Tag each function as an OSL library function to help with
// inlining and optimization after codegen.
Expand Down

0 comments on commit dee0540

Please sign in to comment.