Skip to content

Commit

Permalink
[CODEGEN] Show an error if shared memory size is too large on P100
Browse files Browse the repository at this point in the history
  • Loading branch information
shintaro-iwasaki committed Oct 31, 2022
1 parent 55a1ade commit 5080836
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/codegen/pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ std::unique_ptr<llvm::Module> add_passes_to_emit_bin(
// ir.print(std::cout);
isel.visit(ir, *llvm);
shared_static = allocation.allocated_size();
if (target->as_nvidia() && target->as_nvidia()->sm() < 70) {
// sm < 70 (Pascal) has little shared memory resource.
// Instead of having "Error: Invalid argument" on launching a kernel, let's throw an error here.
if (shared_static >= 65536) {
throw std::runtime_error("Device does not support shared memory of " + std::to_string(shared_static) + "bytes");
}
}

if (isel.get_extern_lib_map().size() > 0) {
// If there's any extern lib calls,
Expand Down

0 comments on commit 5080836

Please sign in to comment.