From a8f62b4453ea621bf5c7bf710d9c57aad733177a Mon Sep 17 00:00:00 2001 From: swfly Date: Fri, 29 Nov 2024 09:27:27 +0800 Subject: [PATCH] fallback callable argument vector size set to 64 --- src/backends/fallback/fallback_codegen.cpp | 2 +- src/backends/fallback/fallback_shader.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/backends/fallback/fallback_codegen.cpp b/src/backends/fallback/fallback_codegen.cpp index ba9cdfbd2..aeb8e18f2 100644 --- a/src/backends/fallback/fallback_codegen.cpp +++ b/src/backends/fallback/fallback_codegen.cpp @@ -2608,7 +2608,7 @@ class FallbackCodegen { case xir::DerivedInstructionTag::CALL: { auto call_inst = static_cast(inst); auto llvm_func = llvm::cast(_lookup_value(current, b, call_inst->callee())); - llvm::SmallVector llvm_args; + llvm::SmallVector 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)); diff --git a/src/backends/fallback/fallback_shader.cpp b/src/backends/fallback/fallback_shader.cpp index e98154f69..02d25e80c 100644 --- a/src/backends/fallback/fallback_shader.cpp +++ b/src/backends/fallback/fallback_shader.cpp @@ -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(); auto llvm_module = luisa_fallback_backend_codegen(*llvm_ctx, xir_module); @@ -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()); @@ -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