Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
979704d
Fix not applicable on statement for convert_to_guarded_return
A4-Tacks Oct 26, 2025
c0ecf1a
Implement Span::line() and Span::column() for proc-macro server
tilladam Jan 2, 2026
fd1457d
Merge pull request #21405 from tilladam/master
Veykril Jan 5, 2026
4fbc520
perf: Re-use scratch allocations for `try_evaluate_obligations`
Veykril Jan 5, 2026
978d75e
Merge pull request #21407 from Veykril/push-wlvmrkvowrlr
Veykril Jan 5, 2026
4699fdc
Fix loses exists guard for move_guard
A4-Tacks Jan 6, 2026
a978fdc
fix: use crates where ADT was defined in deref_chain of trait_applica…
sshcrack Jan 6, 2026
6cc9e5c
Document `Query`
Veykril Jan 7, 2026
1af7813
Document `WithFixture`
Veykril Jan 7, 2026
ad02093
feat: Allow rust paths in symbol search
Veykril Jan 7, 2026
dc64aef
fix: Properly lower `SelfOnly` predicates
ShoyuVanilla Jan 4, 2026
74c3f3a
Merge pull request #21414 from sshcrack/master
ShoyuVanilla Jan 7, 2026
e2b5072
Add ProjectJsonTargetSpec.project_root
cormacrelf Dec 2, 2025
ff94498
project-model: Helpers for traversing dep graph in ProjectJson
cormacrelf Dec 2, 2025
3083bde
project-model: Don't do O(n) clones as well as O(n) search
cormacrelf Dec 2, 2025
ac64177
project-model: Return crate by reference
cormacrelf Sep 4, 2024
3b97d38
Fix misuse of ?
cormacrelf Dec 2, 2025
327ea18
flycheck: Make the flycheckable unit a flycheck::PackageSpecifier enum
cormacrelf Sep 4, 2024
95a07db
project-model: Introduce RunnableKind::Flycheck
cormacrelf Sep 4, 2024
2a899bb
flycheck: Use RunnableKind::Flycheck from ProjectJson to flycheck
cormacrelf Sep 4, 2024
7f608da
flycheck: Support {label} in check_overrideCommand as well as $saved_…
cormacrelf Sep 4, 2024
4e61c60
flycheck: Always flycheck single crate if there is a build label from…
cormacrelf Sep 4, 2024
778de45
flycheck: Add display_command to pretty-print flycheck command being …
cormacrelf Sep 4, 2024
53a371c
flycheck: notifications show full command when configured in a rust-p…
cormacrelf Sep 4, 2024
3fdb78c
flycheck: Rename FlycheckConfig::CargoCommand to Automatic
cormacrelf Dec 3, 2025
2d58177
Fix RunnableKind::Run label interpolation
cormacrelf Dec 3, 2025
71e2ded
doc: Update docs for runnables to include run/flycheck
cormacrelf Dec 3, 2025
422597f
doc: make example for workspace.discoverConfig actually work
cormacrelf Dec 3, 2025
f06a6b9
doc: overhaul non-cargo build system docs
cormacrelf Dec 3, 2025
b02e975
Fix hir-ty clippy issue
cormacrelf Jan 7, 2026
be1e357
Merge pull request #21399 from ShoyuVanilla/self-only-preds
ChayimFriedman2 Jan 7, 2026
6a9de22
Prepare for merging from rust-lang/rust
invalid-email-address Jan 8, 2026
09c878a
Merge ref '548e586795f6' from rust-lang/rust
invalid-email-address Jan 8, 2026
e22a450
Merge pull request #21419 from rust-lang/rustc-pull
lnicola Jan 8, 2026
d68a73a
Merge pull request #18043 from cormacrelf/feature/rust-project-discovery
Veykril Jan 8, 2026
5d8a7da
Fixes for builtin derive expansions
ChayimFriedman2 Jan 8, 2026
d87c468
Merge pull request #21421 from ChayimFriedman2/no-derive-register
ChayimFriedman2 Jan 8, 2026
459d77e
Publish smol_str v0.3.5
ChayimFriedman2 Jan 8, 2026
3e1dd59
Merge pull request #21422 from ChayimFriedman2/new-smol-str
ChayimFriedman2 Jan 8, 2026
26be33a
Fix not disable string escape highlights
A4-Tacks Jan 8, 2026
491c320
Merge pull request #21420 from A4-Tacks/disable-string-hl
ChayimFriedman2 Jan 9, 2026
e80fbd4
Fix lifetimes len diagnostics for fn pointers
ChayimFriedman2 Jan 9, 2026
e52695c
internal: Include private definitions in generated rustdoc
Wilfred Jan 9, 2026
66ba447
Merge pull request #21433 from Wilfred/rustdoc_private_items
ChayimFriedman2 Jan 9, 2026
998a5ac
Remove code made redundant by method resolution rewrite
ChayimFriedman2 Jan 9, 2026
bcf059c
Fix issue with ignore attribute for tests where the attribute has a v…
cry-inc Jan 9, 2026
4f7e395
Merge pull request #21432 from ChayimFriedman2/fn-ptr-lifetime-diag
ShoyuVanilla Jan 10, 2026
c825a50
Cleanup
Veykril Jan 10, 2026
2c356a3
Merge pull request #21415 from Veykril/push-qusurvyqwmxt
Veykril Jan 10, 2026
25c0131
Merge pull request #21434 from ChayimFriedman2/traits-mix
ShoyuVanilla Jan 10, 2026
4e18f1d
Abstract proc-macro-srv input and output away
Veykril Jan 10, 2026
366b80e
Merge pull request #21438 from Veykril/push-prppzzzllqso
Veykril Jan 10, 2026
27fef0c
internal: Landing integration test infra for proc-macro-srv-cli
Veykril Jan 10, 2026
83c635a
Merge pull request #21436 from cry-inc/bugfix/fix-ignore-attribute-wi…
ChayimFriedman2 Jan 10, 2026
e40bd1c
Add inherit attributes for extract_function assist
A4-Tacks Jan 11, 2026
8150413
add byte range subrequest/response
Shourya742 Jan 7, 2026
e909b4b
update proc-macro-srv to include byte-range
Shourya742 Jan 7, 2026
e68a654
add byte range to main loop and direct the request via callback and d…
Shourya742 Jan 7, 2026
78d243c
add comment on incrementality of subrequest
Shourya742 Jan 8, 2026
d30f7c9
add write read imports
Shourya742 Jan 11, 2026
581444f
Merge pull request #21416 from Shourya742/2026-01-07-add-byte-range
Veykril Jan 11, 2026
33f0f80
add make corresponding constructor methods in SyntaxFactory
Shourya742 Jan 11, 2026
16d74e7
migrate generate_mut_trait_impl to new SyntaxEditor
Shourya742 Jan 11, 2026
594ca4b
Prepare for merging from rust-lang/rust
invalid-email-address Jan 12, 2026
0f0951f
Merge ref '44a5b55557c2' from rust-lang/rust
invalid-email-address Jan 12, 2026
80acef1
Format code
invalid-email-address Jan 12, 2026
b4d49de
Merge pull request #21439 from Veykril/push-okkmmxmnwyxm
Veykril Jan 12, 2026
294a0af
Disable `unused_variables` and `unused_mut` warnings
ChayimFriedman2 Jan 12, 2026
19aae35
Create a new `SymbolKind::CrateRoot`
Veykril Jan 12, 2026
5f6d385
Fix crate root search in world symbols duplicating root entries
Veykril Jan 12, 2026
8cbceb4
Merge pull request #21446 from Veykril/veykril/push-wnuyntxqruqm
Veykril Jan 12, 2026
febc131
Merge pull request #21444 from rust-lang/rustc-pull
lnicola Jan 12, 2026
55f6901
Fix lowering with supertrait predicates
Wilfred Dec 29, 2025
e6e5e5d
Merge pull request #21364 from Wilfred/fix_cycle_projections
ChayimFriedman2 Jan 12, 2026
01ebc28
smol_str: update changelog 0.3.5
alexheretic Jan 12, 2026
c20e6a1
Fix not complete `mut` and `raw` in `&x.foo()`
A4-Tacks Jan 12, 2026
21790ef
Merge pull request #21445 from ChayimFriedman2/disable-mir-warnings
Veykril Jan 12, 2026
62e777c
Fix overlapping cfg attributes for wasm32-unknown-emscripten target
robertoaloi Jan 12, 2026
bc7f853
Merge pull request #21448 from alexheretic/smol-str-changelog-0.3.5
ChayimFriedman2 Jan 12, 2026
dc029f0
Merge pull request #21450 from robertoaloi/wasm32-overlapping-cfg
lnicola Jan 12, 2026
9a5aa90
Add some clarifications and fixes for fmt syntax
ehuss Jan 12, 2026
3950a27
Merge pull request #21443 from Shourya742/2026-01-11-migrate-get_mut_…
ShoyuVanilla Jan 13, 2026
1a2200a
Merge pull request #21451 from A4-Tacks/comp-ref-mut-before-method-call
ShoyuVanilla Jan 13, 2026
38fb3a7
Merge pull request #21412 from A4-Tacks/move-guard-exist
ShoyuVanilla Jan 13, 2026
58b85be
Merge pull request #20946 from A4-Tacks/to-guarded-in-stmt
ShoyuVanilla Jan 13, 2026
467b4e4
Merge pull request #21442 from A4-Tacks/extract-func-attrs
ShoyuVanilla Jan 13, 2026
2c32c0e
Make `naked_asm!()` always return `!`
ChayimFriedman2 Jan 13, 2026
a215480
Migrate `unwrap_block` assist to use SyntaxEditor
A4-Tacks Jan 13, 2026
8d983e9
Merge pull request #21456 from ChayimFriedman2/naked-asm
Veykril Jan 13, 2026
8fb704c
fix: Hide renamed imports from macros in symbol index
Veykril Jan 13, 2026
c3dfd5d
Merge pull request #21459 from Veykril/push-oqtvruwxtsyn
Veykril Jan 13, 2026
6948a66
fix: Sync cast checks to rustc again
ShoyuVanilla Jan 13, 2026
332287d
Merge pull request #21462 from ShoyuVanilla/cast-fix
ChayimFriedman2 Jan 13, 2026
6b21796
Merge pull request #21458 from A4-Tacks/migrate-unwrap-block
ShoyuVanilla Jan 14, 2026
05939a8
Fix false positive precedence in `(2 as i32) < 3`
A4-Tacks Jan 14, 2026
4b5b42c
remove postcard from legacy
Shourya742 Jan 14, 2026
31817f6
remove flatten from ExpandMacro message in bidirectional messages
Shourya742 Jan 14, 2026
3f9de55
Merge pull request #21466 from Shourya742/2026-01-14-remove-postcard-…
Veykril Jan 14, 2026
98e1f71
Bump camino to 1.2.2
robertoaloi Jan 14, 2026
0d8aa89
fix: Fix path symbol search not respecting re-exports
Veykril Jan 14, 2026
1790ab0
Merge pull request #21464 from Veykril/push-myvkmuxpzkvp
Veykril Jan 14, 2026
6ecee2a
internal: Improve docs for discoverConfig
Wilfred Jan 14, 2026
77f372f
Merge pull request #21467 from robertoaloi/ra-upgrade
lnicola Jan 14, 2026
c31add0
Prepare for merging from rust-lang/rust
invalid-email-address Jan 15, 2026
52159b6
Merge ref 'b6fdaf2a1573' from rust-lang/rust
invalid-email-address Jan 15, 2026
5c1acd6
Merge pull request #21471 from rust-lang/rustc-pull
lnicola Jan 15, 2026
70f4111
Merge pull request #21465 from A4-Tacks/prec-cast-before-angle
ShoyuVanilla Jan 15, 2026
d859656
fix: lookup flycheck by ID instead of vector index
lukasoyen Jan 15, 2026
c6ec8ea
Merge pull request #21475 from lukasoyen/fix-flycheck-indexing
ShoyuVanilla Jan 16, 2026
4870a5f
add worker abstraction
Shourya742 Jan 1, 2026
98d4496
add termination flag to procmacroserverprocess
Shourya742 Jan 1, 2026
9fb5d34
add pool of processes
Shourya742 Jan 1, 2026
c685aa9
direct client calls via pool
Shourya742 Jan 2, 2026
82e758a
add better process picker and improve loading dylib
Shourya742 Jan 2, 2026
922bc7e
rename process to pool in ProcMacro struct
Shourya742 Jan 2, 2026
c4c336a
keep it clean and tidy
Shourya742 Jan 2, 2026
c8a3551
change callback from FnMut to Fn as we only transform messages and no…
Shourya742 Jan 3, 2026
66bca6a
propagate error from load dylibs
Shourya742 Jan 3, 2026
09c91b7
pick workers which have not exited
Shourya742 Jan 3, 2026
0936597
add version to pool
Shourya742 Jan 3, 2026
263015a
remove expand from pool
Shourya742 Jan 4, 2026
e3e7c29
remove default pool size from pool
Shourya742 Jan 5, 2026
96ecd17
add num process in config
Shourya742 Jan 5, 2026
9d5e600
add proc_macro_processes in load config
Shourya742 Jan 5, 2026
721361f
update all cli workflows
Shourya742 Jan 5, 2026
0587cbd
optimize pick_process to short circuit and return as early as possibl…
Shourya742 Jan 5, 2026
b49417e
fix test and update some autogen files
Shourya742 Jan 5, 2026
a81da31
rename from proc_macro_processes to procMacro_processes
Shourya742 Jan 5, 2026
8da5de0
rebased changes
Shourya742 Jan 11, 2026
c31698b
Improve move_guard redundanted block
A4-Tacks Jan 17, 2026
060c6f1
Merge pull request #21468 from Wilfred/improve_discover_docs
lnicola Jan 18, 2026
cbad6dd
fix: Do not show sysroot dependencies in symbol search
Veykril Jan 16, 2026
bfbee86
feat: Trigger flycheck if non-workspace files get modified
Veykril Jan 16, 2026
8f12958
Merge pull request #21483 from Veykril/push-vswqqvzqyvnv
Veykril Jan 18, 2026
7bbe902
Merge pull request #21484 from Veykril/push-uoxwkwottnqn
Veykril Jan 18, 2026
ebcbff2
Do not mix the order of builtin/regular derives in "Expand macro recu…
ChayimFriedman2 Jan 19, 2026
4dad9b9
Insert type vars and normalize for the type of a used `static`
ChayimFriedman2 Jan 19, 2026
1285b1b
Ensure correct capturing of async fn params even when they use weird …
ChayimFriedman2 Jan 19, 2026
ad7d5ea
Merge pull request #21385 from Shourya742/2026-01-01-parallelize-proc…
lnicola Jan 19, 2026
740eb6b
remove non-describing field annotation from bidirectional message def…
Shourya742 Jan 15, 2026
ffa2dad
remove serialize from Expn Globals
Shourya742 Jan 18, 2026
8fd5569
add bidirectional flow
Shourya742 Jan 18, 2026
ee35fd6
add bidirectional test
Shourya742 Jan 18, 2026
a151d7d
adapt json test
Shourya742 Jan 18, 2026
095b013
rename send and drive to request and receive and remove auto*
Shourya742 Jan 18, 2026
29aad04
Cache `Clauses::empty()`
ChayimFriedman2 Jan 19, 2026
a894e85
Merge pull request #21493 from ChayimFriedman2/perf-fixup
ChayimFriedman2 Jan 19, 2026
ab0853b
Merge pull request #21491 from ChayimFriedman2/static-insert-var
ShoyuVanilla Jan 19, 2026
dbee105
Merge pull request #21492 from ChayimFriedman2/async-fn
ShoyuVanilla Jan 20, 2026
92903fa
Merge pull request #21485 from A4-Tacks/move-guard-clean-block
ShoyuVanilla Jan 20, 2026
e07da1f
feat(hir-ty): add method references_only_ty_error to detect type errors
ileixe Jan 20, 2026
61b9b33
Fix demorgan applicable on pattern conditional
A4-Tacks Jan 20, 2026
c177a39
Merge pull request #21497 from ileixe/issue-21315
ShoyuVanilla Jan 20, 2026
4311139
move initialization of omp/ol runtimes into global_ctor/dtor
ZuseZ4 Jan 9, 2026
8e937d4
Bump notify from 8.0.0. to 8.2.0
robertoaloi Jan 21, 2026
fd80a3e
Merge pull request #21490 from ChayimFriedman2/expand-derive-builtin
Veykril Jan 21, 2026
c8edb52
Merge pull request #21499 from A4-Tacks/not-demorgan-pattern
lnicola Jan 21, 2026
6753155
Prepare for merging from rust-lang/rust
invalid-email-address Jan 22, 2026
ee0fabd
Merge ref '004d710faff5' from rust-lang/rust
invalid-email-address Jan 22, 2026
42d9942
Merge pull request #21506 from rust-lang/rustc-pull
lnicola Jan 22, 2026
4e9e37e
internal: Add tests for rust-lang/rust#146972
Veykril Jan 23, 2026
b5bb005
Merge pull request #21509 from Veykril/push-zwownxpqxrnw
Veykril Jan 23, 2026
bd91c88
Improve extract_function name
A4-Tacks Jan 24, 2026
3f39593
fix: Fix incorrect continue for convert_range_for_to_while
A4-Tacks Jan 24, 2026
af21cbe
Merge pull request #21479 from Shourya742/2026-01-15-add-bidirectiona…
Veykril Jan 24, 2026
a443498
Merge pull request #21501 from robertoaloi/ra-bump-notify
Veykril Jan 24, 2026
cb603ad
internal: Use parser expect where possible
pksunkara Jan 25, 2026
45ef766
Merge pull request #21518 from pksunkara/pavan/jj/uwxtukzt
Veykril Jan 25, 2026
2a3614b
correct ungrammar path in patch
Shourya742 Jan 26, 2026
4fae402
Merge pull request #21523 from Shourya742/2026-01-26-correct-ungramma…
ChayimFriedman2 Jan 26, 2026
803b7cc
Merge pull request #21514 from A4-Tacks/range-for-to-while-handle-con…
ChayimFriedman2 Jan 26, 2026
9fd291e
Fix not complete 'else' before tuple
A4-Tacks Jan 19, 2026
acfb441
Merge pull request #21495 from A4-Tacks/comp-else-before-tuple
ChayimFriedman2 Jan 26, 2026
2f49df3
Improve filter predicate to length cond
A4-Tacks Jan 26, 2026
38bb09e
Fix rust-src installation command in FAQ
edwin0cheng Jan 26, 2026
d7136ca
Merge pull request #21524 from edwin0cheng/patch-1
lnicola Jan 26, 2026
b75c58d
Implement default field values `..` syntax
kouhe3 Jan 5, 2026
e0ebb92
Merge pull request #21513 from A4-Tacks/extract-fun-name
ChayimFriedman2 Jan 26, 2026
6531c75
Merge pull request #21408 from kouhe3/default_field_values
ChayimFriedman2 Jan 26, 2026
2c2602b
Fix macro matching of `meta` then `=>` or `==`
ChayimFriedman2 Jan 26, 2026
cd8fe54
Fix semicolon for toggle_macro_delimiter
A4-Tacks Jan 25, 2026
0828abf
Merge pull request #21522 from A4-Tacks/tog-macro-delim-semicolon
ChayimFriedman2 Jan 26, 2026
6664fc6
minor: Downgrade noisy log
Veykril Jan 27, 2026
cce824a
Merge pull request #21531 from Veykril/push-usuormvursms
Veykril Jan 27, 2026
89d7695
Rename `DynamicQuery` to `QueryVTable`
Zalathar Jan 25, 2026
2c9175d
Rename trait `QueryConfig` to `QueryDispatcher`
Zalathar Jan 25, 2026
4430fd8
Merge pull request #21527 from ChayimFriedman2/builtin-macro-name
ShoyuVanilla Jan 27, 2026
c8975a2
Add `extern core` to diagnostic tests
JonathanBrouwer Jan 27, 2026
c420ed5
fix: Do not panic if rust-analyzer fails to spawn the discover command
Veykril Jan 27, 2026
b28e6f0
Merge pull request #21534 from Veykril/push-polxrwlzrzrx
Veykril Jan 27, 2026
bf12b8b
Fix linking of proc-macro-srv-cli
lnicola Jan 27, 2026
f1d10bb
Merge pull request #21535 from lnicola/proc-macro-srv-cli-link
ChayimFriedman2 Jan 27, 2026
3491099
Prepare for merging from rust-lang/rust
lnicola Jan 27, 2026
83e479c
Merge ref '94a0cd15f597' from rust-lang/rust
lnicola Jan 27, 2026
c5faba7
Fix sysroot-abi build
lnicola Jan 27, 2026
2c0a0bb
Merge pull request #21537 from lnicola/sync-from-rust
lnicola Jan 27, 2026
4a0c044
Update stderrs
JonathanBrouwer Jan 27, 2026
d400dca
Fix postcard test too
lnicola Jan 27, 2026
7eae36f
Add an early return if handling multiple offload calls
ZuseZ4 Jan 9, 2026
35ce8ab
adjust testcase for new logic
ZuseZ4 Jan 9, 2026
1f11bf6
Leave note to drop tgt_init_all_rtls in the future
ZuseZ4 Jan 13, 2026
83dcfc8
Update `browser-ui-test` version to `0.23.3`
GuillaumeGomez Jan 27, 2026
1e7b41d
Rollup merge of #151751 - lnicola:sync-from-ra, r=lnicola
matthiaskrgr Jan 27, 2026
224ad43
Rollup merge of #150893 - ZuseZ4:move-un-register-lib, r=oli-obk
matthiaskrgr Jan 27, 2026
06850b1
Rollup merge of #151013 - ehuss:fmt-clarification, r=joboet
matthiaskrgr Jan 27, 2026
1b526c1
Rollup merge of #151666 - Zalathar:query-vtable, r=Kivooeo
matthiaskrgr Jan 27, 2026
403e91c
Rollup merge of #151738 - JonathanBrouwer:fix, r=Kivooeo
matthiaskrgr Jan 27, 2026
5c00c97
Rollup merge of #151759 - GuillaumeGomez:update-browser-ui-test, r=Gu…
matthiaskrgr Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,6 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
load
}
}

fn memset(&mut self, ptr: &'ll Value, fill_byte: &'ll Value, size: &'ll Value, align: Align) {
unsafe {
llvm::LLVMRustBuildMemSet(
self.llbuilder,
ptr,
align.bytes() as c_uint,
fill_byte,
size,
false,
);
}
}
}

/// Empty string, to be used where LLVM expects an instruction name, indicating
Expand Down
100 changes: 69 additions & 31 deletions compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub(crate) struct OffloadGlobals<'ll> {
pub launcher_fn: &'ll llvm::Value,
pub launcher_ty: &'ll llvm::Type,

pub bin_desc: &'ll llvm::Type,

pub kernel_args_ty: &'ll llvm::Type,

pub offload_entry_ty: &'ll llvm::Type,
Expand All @@ -31,8 +29,8 @@ pub(crate) struct OffloadGlobals<'ll> {

pub ident_t_global: &'ll llvm::Value,

pub register_lib: &'ll llvm::Value,
pub unregister_lib: &'ll llvm::Value,
// FIXME(offload): Drop this, once we fully automated our offload compilation pipeline, since
// LLVM will initialize them for us if it sees gpu kernels being registered.
pub init_rtls: &'ll llvm::Value,
}

Expand All @@ -44,15 +42,6 @@ impl<'ll> OffloadGlobals<'ll> {
let (begin_mapper, _, end_mapper, mapper_fn_ty) = gen_tgt_data_mappers(cx);
let ident_t_global = generate_at_one(cx);

let tptr = cx.type_ptr();
let ti32 = cx.type_i32();
let tgt_bin_desc_ty = vec![ti32, tptr, tptr, tptr];
let bin_desc = cx.type_named_struct("struct.__tgt_bin_desc");
cx.set_struct_body(bin_desc, &tgt_bin_desc_ty, false);

let reg_lib_decl = cx.type_func(&[cx.type_ptr()], cx.type_void());
let register_lib = declare_offload_fn(&cx, "__tgt_register_lib", reg_lib_decl);
let unregister_lib = declare_offload_fn(&cx, "__tgt_unregister_lib", reg_lib_decl);
let init_ty = cx.type_func(&[], cx.type_void());
let init_rtls = declare_offload_fn(cx, "__tgt_init_all_rtls", init_ty);

Expand All @@ -63,20 +52,84 @@ impl<'ll> OffloadGlobals<'ll> {
OffloadGlobals {
launcher_fn,
launcher_ty,
bin_desc,
kernel_args_ty,
offload_entry_ty,
begin_mapper,
end_mapper,
mapper_fn_ty,
ident_t_global,
register_lib,
unregister_lib,
init_rtls,
}
}
}

// We need to register offload before using it. We also should unregister it once we are done, for
// good measures. Previously we have done so before and after each individual offload intrinsic
// call, but that comes at a performance cost. The repeated (un)register calls might also confuse
// the LLVM ompOpt pass, which tries to move operations to a better location. The easiest solution,
// which we copy from clang, is to just have those two calls once, in the global ctor/dtor section
// of the final binary.
pub(crate) fn register_offload<'ll>(cx: &CodegenCx<'ll, '_>) {
// First we check quickly whether we already have done our setup, in which case we return early.
// Shouldn't be needed for correctness.
let register_lib_name = "__tgt_register_lib";
if cx.get_function(register_lib_name).is_some() {
return;
}

let reg_lib_decl = cx.type_func(&[cx.type_ptr()], cx.type_void());
let register_lib = declare_offload_fn(&cx, register_lib_name, reg_lib_decl);
let unregister_lib = declare_offload_fn(&cx, "__tgt_unregister_lib", reg_lib_decl);

let ptr_null = cx.const_null(cx.type_ptr());
let const_struct = cx.const_struct(&[cx.get_const_i32(0), ptr_null, ptr_null, ptr_null], false);
let omp_descriptor =
add_global(cx, ".omp_offloading.descriptor", const_struct, InternalLinkage);
// @.omp_offloading.descriptor = internal constant %__tgt_bin_desc { i32 1, ptr @.omp_offloading.device_images, ptr @__start_llvm_offload_entries, ptr @__stop_llvm_offload_entries }
// @.omp_offloading.descriptor = internal constant %__tgt_bin_desc { i32 0, ptr null, ptr null, ptr null }

let atexit = cx.type_func(&[cx.type_ptr()], cx.type_i32());
let atexit_fn = declare_offload_fn(cx, "atexit", atexit);

let desc_ty = cx.type_func(&[], cx.type_void());
let reg_name = ".omp_offloading.descriptor_reg";
let unreg_name = ".omp_offloading.descriptor_unreg";
let desc_reg_fn = declare_offload_fn(cx, reg_name, desc_ty);
let desc_unreg_fn = declare_offload_fn(cx, unreg_name, desc_ty);
llvm::set_linkage(desc_reg_fn, InternalLinkage);
llvm::set_linkage(desc_unreg_fn, InternalLinkage);
llvm::set_section(desc_reg_fn, c".text.startup");
llvm::set_section(desc_unreg_fn, c".text.startup");

// define internal void @.omp_offloading.descriptor_reg() section ".text.startup" {
// entry:
// call void @__tgt_register_lib(ptr @.omp_offloading.descriptor)
// %0 = call i32 @atexit(ptr @.omp_offloading.descriptor_unreg)
// ret void
// }
let bb = Builder::append_block(cx, desc_reg_fn, "entry");
let mut a = Builder::build(cx, bb);
a.call(reg_lib_decl, None, None, register_lib, &[omp_descriptor], None, None);
a.call(atexit, None, None, atexit_fn, &[desc_unreg_fn], None, None);
a.ret_void();

// define internal void @.omp_offloading.descriptor_unreg() section ".text.startup" {
// entry:
// call void @__tgt_unregister_lib(ptr @.omp_offloading.descriptor)
// ret void
// }
let bb = Builder::append_block(cx, desc_unreg_fn, "entry");
let mut a = Builder::build(cx, bb);
a.call(reg_lib_decl, None, None, unregister_lib, &[omp_descriptor], None, None);
a.ret_void();

// @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 101, ptr @.omp_offloading.descriptor_reg, ptr null }]
let args = vec![cx.get_const_i32(101), desc_reg_fn, ptr_null];
let const_struct = cx.const_struct(&args, false);
let arr = cx.const_array(cx.val_ty(const_struct), &[const_struct]);
add_global(cx, "llvm.global_ctors", arr, AppendingLinkage);
}

pub(crate) struct OffloadKernelDims<'ll> {
num_workgroups: &'ll Value,
threads_per_block: &'ll Value,
Expand Down Expand Up @@ -487,9 +540,6 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>(
let tgt_decl = offload_globals.launcher_fn;
let tgt_target_kernel_ty = offload_globals.launcher_ty;

// %struct.__tgt_bin_desc = type { i32, ptr, ptr, ptr }
let tgt_bin_desc = offload_globals.bin_desc;

let tgt_kernel_decl = offload_globals.kernel_args_ty;
let begin_mapper_decl = offload_globals.begin_mapper;
let end_mapper_decl = offload_globals.end_mapper;
Expand All @@ -513,12 +563,9 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>(
}

// Step 0)
// %struct.__tgt_bin_desc = type { i32, ptr, ptr, ptr }
// %6 = alloca %struct.__tgt_bin_desc, align 8
unsafe {
llvm::LLVMRustPositionBuilderPastAllocas(&builder.llbuilder, builder.llfn());
}
let tgt_bin_desc_alloca = builder.direct_alloca(tgt_bin_desc, Align::EIGHT, "EmptyDesc");

let ty = cx.type_array(cx.type_ptr(), num_args);
// Baseptr are just the input pointer to the kernel, stored in a local alloca
Expand All @@ -536,7 +583,6 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>(
unsafe {
llvm::LLVMPositionBuilderAtEnd(&builder.llbuilder, bb);
}
builder.memset(tgt_bin_desc_alloca, cx.get_const_i8(0), cx.get_const_i64(32), Align::EIGHT);

// Now we allocate once per function param, a copy to be passed to one of our maps.
let mut vals = vec![];
Expand Down Expand Up @@ -574,15 +620,9 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>(
geps.push(gep);
}

let mapper_fn_ty = cx.type_func(&[cx.type_ptr()], cx.type_void());
let register_lib_decl = offload_globals.register_lib;
let unregister_lib_decl = offload_globals.unregister_lib;
let init_ty = cx.type_func(&[], cx.type_void());
let init_rtls_decl = offload_globals.init_rtls;

// FIXME(offload): Later we want to add them to the wrapper code, rather than our main function.
// call void @__tgt_register_lib(ptr noundef %6)
builder.call(mapper_fn_ty, None, None, register_lib_decl, &[tgt_bin_desc_alloca], None, None);
// call void @__tgt_init_all_rtls()
builder.call(init_ty, None, None, init_rtls_decl, &[], None, None);

Expand Down Expand Up @@ -679,6 +719,4 @@ pub(crate) fn gen_call_handling<'ll, 'tcx>(
num_args,
s_ident_t,
);

builder.call(mapper_fn_ty, None, None, unregister_lib_decl, &[tgt_bin_desc_alloca], None, None);
}
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
pub(crate) fn const_null(&self, t: &'ll Type) -> &'ll Value {
unsafe { llvm::LLVMConstNull(t) }
}

pub(crate) fn const_struct(&self, elts: &[&'ll Value], packed: bool) -> &'ll Value {
struct_in_context(self.llcx(), elts, packed)
}
}

impl<'ll, 'tcx> ConstCodegenMethods for CodegenCx<'ll, 'tcx> {
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ use tracing::debug;
use crate::abi::FnAbiLlvmExt;
use crate::builder::Builder;
use crate::builder::autodiff::{adjust_activity_to_abi, generate_enzyme_call};
use crate::builder::gpu_offload::{OffloadKernelDims, gen_call_handling, gen_define_handling};
use crate::builder::gpu_offload::{
OffloadKernelDims, gen_call_handling, gen_define_handling, register_offload,
};
use crate::context::CodegenCx;
use crate::declare::declare_raw_fn;
use crate::errors::{
Expand Down Expand Up @@ -1402,6 +1404,7 @@ fn codegen_offload<'ll, 'tcx>(
return;
}
};
register_offload(cx);
let offload_data = gen_define_handling(&cx, &metadata, target_symbol, offload_globals);
gen_call_handling(bx, &offload_data, &args, &types, &metadata, offload_globals, &offload_dims);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ use crate::mir::mono::{
CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions, NormalizationErrorInMono,
};
use crate::query::erase::{Erase, erase, restore};
use crate::query::plumbing::{CyclePlaceholder, DynamicQuery};
use crate::query::plumbing::CyclePlaceholder;
use crate::traits::query::{
CanonicalAliasGoal, CanonicalDropckOutlivesGoal, CanonicalImpliedOutlivesBoundsGoal,
CanonicalMethodAutoderefStepsGoal, CanonicalPredicateGoal, CanonicalTypeOpAscribeUserTypeGoal,
Expand Down
16 changes: 11 additions & 5 deletions compiler/rustc_middle/src/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ use crate::dep_graph;
use crate::dep_graph::DepKind;
use crate::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex, OnDiskCache};
use crate::query::{
DynamicQueries, ExternProviders, Providers, QueryArenas, QueryCaches, QueryEngine, QueryStates,
ExternProviders, PerQueryVTables, Providers, QueryArenas, QueryCaches, QueryEngine, QueryStates,
};
use crate::ty::TyCtxt;

pub struct DynamicQuery<'tcx, C: QueryCache> {
/// Stores function pointers and other metadata for a particular query.
///
/// Used indirectly by query plumbing in `rustc_query_system`, via a trait.
pub struct QueryVTable<'tcx, C: QueryCache> {
pub name: &'static str,
pub eval_always: bool,
pub dep_kind: DepKind,
Expand Down Expand Up @@ -62,7 +65,7 @@ pub struct QuerySystem<'tcx> {
pub states: QueryStates<'tcx>,
pub arenas: WorkerLocal<QueryArenas<'tcx>>,
pub caches: QueryCaches<'tcx>,
pub dynamic_queries: DynamicQueries<'tcx>,
pub query_vtables: PerQueryVTables<'tcx>,

/// This provides access to the incremental compilation on-disk cache for query results.
/// Do not access this directly. It is only meant to be used by
Expand Down Expand Up @@ -418,9 +421,12 @@ macro_rules! define_callbacks {
})*
}

pub struct DynamicQueries<'tcx> {
/// Holds a `QueryVTable` for each query.
///
/// ("Per" just makes this pluralized name more visually distinct.)
pub struct PerQueryVTables<'tcx> {
$(
pub $name: DynamicQuery<'tcx, queries::$name::Storage<'tcx>>,
pub $name: ::rustc_middle::query::plumbing::QueryVTable<'tcx, queries::$name::Storage<'tcx>>,
)*
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse_format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ impl<'input> Parser<'input> {
}

/// Parses a word starting at the current position. A word is the same as a
/// Rust identifier, except that it can't start with `_` character.
/// Rust identifier or keyword, except that it can't be a bare `_` character.
fn word(&mut self) -> &'input str {
let index = self.input_vec_index;
match self.peek() {
Expand Down
Loading
Loading