Skip to content

Commit

Permalink
fallback callable argument vector size set to 64
Browse files Browse the repository at this point in the history
  • Loading branch information
swfly committed Nov 29, 2024
1 parent b683555 commit a8f62b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/backends/fallback/fallback_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2608,7 +2608,7 @@ class FallbackCodegen {
case xir::DerivedInstructionTag::CALL: {
auto call_inst = static_cast<const xir::CallInst *>(inst);
auto llvm_func = llvm::cast<llvm::Function>(_lookup_value(current, b, call_inst->callee()));
llvm::SmallVector<llvm::Value *, 16u> llvm_args;
llvm::SmallVector<llvm::Value *, 64u> llvm_args;
llvm_args.reserve(call_inst->argument_count());
for (auto i = 0u; i < call_inst->argument_count(); i++) {
auto llvm_arg = _lookup_value(current, b, call_inst->argument(i));
Expand Down
14 changes: 13 additions & 1 deletion src/backends/fallback/fallback_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ luisa::compute::fallback::FallbackShader::FallbackShader(const luisa::compute::S
auto xir_module = xir::ast_to_xir_translate(kernel, {});
xir_module->set_name(luisa::format("kernel_{:016x}", kernel.hash()));
if (!option.name.empty()) { xir_module->set_location(option.name); }
//LUISA_INFO("Kernel XIR:\n{}", xir::xir_to_text_translate(xir_module, true));
// LUISA_INFO("Kernel XIR:\n{}", xir::xir_to_text_translate(xir_module, true));

auto llvm_ctx = std::make_unique<llvm::LLVMContext>();
auto llvm_module = luisa_fallback_backend_codegen(*llvm_ctx, xir_module);
Expand All @@ -139,6 +139,12 @@ luisa::compute::fallback::FallbackShader::FallbackShader(const luisa::compute::S
if (llvm::verifyModule(*llvm_module, &llvm::errs())) {
LUISA_ERROR_WITH_LOCATION("LLVM module verification failed.");
}
// {
// std::error_code EC;
// llvm::raw_fd_ostream file_stream("abc.ll", EC, llvm::sys::fs::OF_None);
// llvm_module->print(file_stream, nullptr, true, true);
// file_stream.close();
// }

// optimize
llvm_module->setDataLayout(_target_machine->createDataLayout());
Expand Down Expand Up @@ -175,6 +181,12 @@ luisa::compute::fallback::FallbackShader::FallbackShader(const luisa::compute::S
if (::llvm::verifyModule(*llvm_module, &::llvm::errs())) {
LUISA_ERROR_WITH_LOCATION("Failed to verify module.");
}
// {
// std::error_code EC;
// llvm::raw_fd_ostream file_stream("bbc.ll", EC, llvm::sys::fs::OF_None);
// llvm_module->print(file_stream, nullptr, true, true);
// file_stream.close();
// }
//llvm_module->print(llvm::outs(), nullptr, true, true);

// compile to machine code
Expand Down

0 comments on commit a8f62b4

Please sign in to comment.