Skip to content

Commit b48988d

Browse files
committed
stop compilation when static memory exceeds limits + add hints
1 parent 25d8ac1 commit b48988d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

crates/rustc_codegen_nvvm/src/context.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,17 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
303303

304304
// Check if adding this static would exceed the cumulative limit
305305
if new_usage > CONSTANT_MEMORY_SIZE_LIMIT_BYTES {
306-
self.tcx.sess.dcx().err(format!(
306+
self.fatal(format!(
307307
"cannot place static `{instance}` ({size_bytes} bytes) in constant memory: \
308308
cumulative constant memory usage would be {new_usage} bytes, exceeding the {} byte limit. \
309309
Current usage: {current_usage} bytes. \
310-
Consider: (1) using `#[cuda_std::address_space(global)]` on less frequently accessed statics, \
311-
(2) reducing static data sizes, or (3) disabling automatic constant memory placement",
310+
\n\
311+
= help: use `#[cuda_std::address_space(global)]` on less frequently accessed statics\n\
312+
= help: reducing static data size\n\
313+
= help: disabling automatic constant memory placement by calling `.use_constant_memory_space(false)` \
314+
on your `CudaBuilder` in build.rs",
312315
CONSTANT_MEMORY_SIZE_LIMIT_BYTES
313316
));
314-
return AddressSpace(1);
315317
}
316318

317319
// If successfully placed in constant memory: update cumulative usage

0 commit comments

Comments
 (0)