make volatile operations const#159092
Conversation
|
cc @rust-lang/miri Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @oli-obk, @lcnr Some changes occurred to the CTFE machinery Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri |
|
r? @JohnTitor rustbot has assigned @JohnTitor. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| self.typed_swap_nonoverlapping_intrinsic(&args[0], &args[1])?; | ||
| } | ||
|
|
||
| sym::volatile_load => { |
There was a problem hiding this comment.
This is the shared space for intrinsics for miri and ctfe. But this impl will only be used by ctfe, so it should live in the ctfe intrinsic impl file
There was a problem hiding this comment.
No, the same impl should be used by CTFE and Miri.
There was a problem hiding this comment.
Ah I assumed we'd want do so extra checks in miri, although who but other threads would be randomly modifying memory idk either
|
@bors rollup |
make volatile operations const This came up in gfx-rs/wgpu#8897 (comment). The tl;dr is that it can be useful to have shared codepaths between things that need to work on special memory (and hence need to use volatile) and things that work on regular Rust memory, and for the regular Rust memory case those things totally could and should be `const fn`. So, let's (unstably, for now) allow volatile reads and writes in `const`, and specify them to behave just like normal reads and writes. In const we *know* that there's nobody trying to observe those locations so there's nothing special we have to do with those accesses. Cc @rust-lang/opsem @rust-lang/wg-const-eval Tracking issue: rust-lang#159094
make volatile operations const This came up in gfx-rs/wgpu#8897 (comment). The tl;dr is that it can be useful to have shared codepaths between things that need to work on special memory (and hence need to use volatile) and things that work on regular Rust memory, and for the regular Rust memory case those things totally could and should be `const fn`. So, let's (unstably, for now) allow volatile reads and writes in `const`, and specify them to behave just like normal reads and writes. In const we *know* that there's nobody trying to observe those locations so there's nothing special we have to do with those accesses. Cc @rust-lang/opsem @rust-lang/wg-const-eval Tracking issue: rust-lang#159094
Rollup of 15 pull requests Successful merges: - #159106 (Update LLVM) - #157690 (codegen_ssa: pack small const aggregates into immediate stores) - #159005 (Use `as_lang_item` instead of repeatedly matching) - #156735 (Move NativeLib::filename to the rmeta-link archive member) - #157153 (allow `Allocator`s to be used as `#[global_allocator]`s) - #158269 (jq directives for jsondocck) - #158767 (merge DefKind::InlineConst into AnonConst) - #159099 (Stabilize String::from_utf8_lossy_owned) - #158930 (Reorganize `tests/ui/issues` [20/N]) - #158965 (Add codegen test for Result is_ok unwrap) - #158979 (Reorganize `tests/ui/issues` [21/N]) - #159050 (assert only opaques with sub unified hidden infer are non-rigid) - #159062 (Remove unused WEAK_ONLY_LANG_ITEMS static) - #159070 (Add `io::ErrorKind::InputOutputError`) - #159092 (make volatile operations const)
Rollup of 15 pull requests Successful merges: - #159106 (Update LLVM) - #157690 (codegen_ssa: pack small const aggregates into immediate stores) - #159005 (Use `as_lang_item` instead of repeatedly matching) - #156735 (Move NativeLib::filename to the rmeta-link archive member) - #157153 (allow `Allocator`s to be used as `#[global_allocator]`s) - #158269 (jq directives for jsondocck) - #158767 (merge DefKind::InlineConst into AnonConst) - #159099 (Stabilize String::from_utf8_lossy_owned) - #158930 (Reorganize `tests/ui/issues` [20/N]) - #158965 (Add codegen test for Result is_ok unwrap) - #158979 (Reorganize `tests/ui/issues` [21/N]) - #159050 (assert only opaques with sub unified hidden infer are non-rigid) - #159062 (Remove unused WEAK_ONLY_LANG_ITEMS static) - #159070 (Add `io::ErrorKind::InputOutputError`) - #159092 (make volatile operations const)
Rollup merge of #159092 - RalfJung:const-volatile, r=oli-obk make volatile operations const This came up in gfx-rs/wgpu#8897 (comment). The tl;dr is that it can be useful to have shared codepaths between things that need to work on special memory (and hence need to use volatile) and things that work on regular Rust memory, and for the regular Rust memory case those things totally could and should be `const fn`. So, let's (unstably, for now) allow volatile reads and writes in `const`, and specify them to behave just like normal reads and writes. In const we *know* that there's nobody trying to observe those locations so there's nothing special we have to do with those accesses. Cc @rust-lang/opsem @rust-lang/wg-const-eval Tracking issue: #159094
|
@rust-timer build 95ccb43 |
This comment has been minimized.
This comment has been minimized.
Rollup of 15 pull requests Successful merges: - rust-lang/rust#159106 (Update LLVM) - rust-lang/rust#157690 (codegen_ssa: pack small const aggregates into immediate stores) - rust-lang/rust#159005 (Use `as_lang_item` instead of repeatedly matching) - rust-lang/rust#156735 (Move NativeLib::filename to the rmeta-link archive member) - rust-lang/rust#157153 (allow `Allocator`s to be used as `#[global_allocator]`s) - rust-lang/rust#158269 (jq directives for jsondocck) - rust-lang/rust#158767 (merge DefKind::InlineConst into AnonConst) - rust-lang/rust#159099 (Stabilize String::from_utf8_lossy_owned) - rust-lang/rust#158930 (Reorganize `tests/ui/issues` [20/N]) - rust-lang/rust#158965 (Add codegen test for Result is_ok unwrap) - rust-lang/rust#158979 (Reorganize `tests/ui/issues` [21/N]) - rust-lang/rust#159050 (assert only opaques with sub unified hidden infer are non-rigid) - rust-lang/rust#159062 (Remove unused WEAK_ONLY_LANG_ITEMS static) - rust-lang/rust#159070 (Add `io::ErrorKind::InputOutputError`) - rust-lang/rust#159092 (make volatile operations const)
|
Finished benchmarking commit (95ccb43): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.3%, secondary 1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 490.729s -> 491.445s (0.15%) |
|
@rustbot label: +perf-regression-triaged |
This came up in gfx-rs/wgpu#8897 (comment). The tl;dr is that it can be useful to have shared codepaths between things that need to work on special memory (and hence need to use volatile) and things that work on regular Rust memory, and for the regular Rust memory case those things totally could and should be
const fn.So, let's (unstably, for now) allow volatile reads and writes in
const, and specify them to behave just like normal reads and writes. In const we know that there's nobody trying to observe those locations so there's nothing special we have to do with those accesses.Cc @rust-lang/opsem @rust-lang/wg-const-eval
Tracking issue: #159094