-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
add spirv64-intel-unknown target triple #151549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5a3184e
0b00be2
2a85226
fdcc73e
1165a46
0d673e5
376ba00
9e1fff8
13a732e
c8b9f1c
66dc7f6
bd29d0a
db5c105
cdab1e7
3cb0b65
e885a29
6e7fb35
bceda28
0cfbee6
7c0207f
660a91a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| use rustc_abi::{HasDataLayout, TyAbiInterface}; | ||
|
|
||
| use crate::callconv::{ArgAbi, FnAbi}; | ||
|
|
||
| fn classify_ret<'a, Ty, C>(_cx: &C, ret: &mut ArgAbi<'a, Ty>) | ||
| where | ||
| Ty: TyAbiInterface<'a, C> + Copy, | ||
| C: HasDataLayout, | ||
| { | ||
| ret.extend_integer_width_to(32); | ||
| } | ||
|
|
||
| fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) | ||
| where | ||
| Ty: TyAbiInterface<'a, C> + Copy, | ||
| C: HasDataLayout, | ||
| { | ||
| if arg.layout.pass_indirectly_in_non_rustic_abis(cx) { | ||
| arg.make_indirect(); | ||
| return; | ||
| } | ||
| arg.extend_integer_width_to(32); | ||
| } | ||
|
|
||
| pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>) | ||
| where | ||
| Ty: TyAbiInterface<'a, C> + Copy, | ||
| C: HasDataLayout, | ||
| { | ||
| if !fn_abi.ret.is_ignore() { | ||
| classify_ret(cx, &mut fn_abi.ret); | ||
| } | ||
|
|
||
| for arg in fn_abi.args.iter_mut() { | ||
| if arg.is_ignore() { | ||
| continue; | ||
| } | ||
| classify_arg(cx, arg); | ||
| } | ||
| } |
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will have to verify stuff in here, for now I just copied from the vulkan triple and changed the data layout. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| use crate::spec::{Arch, LinkerFlavor, Os, PanicStrategy, Target, TargetMetadata, TargetOptions}; | ||
|
|
||
| pub(crate) fn target() -> Target { | ||
| Target { | ||
| llvm_target: "spirv64-intel-unknown".into(), | ||
| metadata: TargetMetadata { | ||
| description: Some("SPIR-V with Intel GPU extensions".into()), | ||
| tier: Some(3), | ||
| host_tools: Some(false), | ||
| std: Some(false), | ||
| }, | ||
| pointer_width: 64, | ||
| data_layout: "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1-P9-A0".into(), | ||
| arch: Arch::SpirV, | ||
| options: TargetOptions { | ||
| os: Os::Unknown, | ||
| vendor: "intel".into(), | ||
| linker_flavor: LinkerFlavor::Llbc, | ||
| max_atomic_width: Some(32), | ||
| panic_strategy: PanicStrategy::Abort, | ||
| // Allow `cdylib` crate type. | ||
| dynamic_linking: true, | ||
| obj_is_bitcode: true, | ||
| only_cdylib: true, | ||
| dll_prefix: "".into(), | ||
| dll_suffix: ".spvt".into(), | ||
| is_like_gpu: true, | ||
| // The LLVM backend does not support stack canaries for this target | ||
| supports_stack_protector: false, | ||
|
|
||
| // Static initializers must not have cycles on this target | ||
| static_initializer_must_be_acyclic: true, | ||
| ..Default::default() | ||
| }, | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| use crate::spec::{Arch, LinkerFlavor, Os, PanicStrategy, Target, TargetMetadata, TargetOptions}; | ||
|
|
||
| pub(crate) fn target() -> Target { | ||
| Target { | ||
| llvm_target: "spirv-unknown-vulkan1.3".into(), | ||
| metadata: TargetMetadata { | ||
| description: Some("Vulkan 1.3".into()), | ||
| tier: Some(3), | ||
| host_tools: Some(false), | ||
| std: Some(false), | ||
| }, | ||
| pointer_width: 64, | ||
| data_layout: "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G10".into(), | ||
| arch: Arch::SpirV, | ||
| options: TargetOptions { | ||
| os: Os::Vulkan, | ||
| vendor: "unknown".into(), | ||
| linker_flavor: LinkerFlavor::Llbc, | ||
| max_atomic_width: Some(32), | ||
| panic_strategy: PanicStrategy::Abort, | ||
| // Allow `cdylib` crate type. | ||
| dynamic_linking: true, | ||
| obj_is_bitcode: true, | ||
| only_cdylib: true, | ||
| dll_prefix: "".into(), | ||
| dll_suffix: ".spvt".into(), | ||
| is_like_gpu: true, | ||
| // The LLVM backend does not support stack canaries for this target | ||
| supports_stack_protector: false, | ||
|
|
||
| // Static initializers must not have cycles on this target | ||
| static_initializer_must_be_acyclic: true, | ||
| ..Default::default() | ||
| }, | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -299,6 +299,7 @@ impl<'f> VaList<'f> { | |
|
|
||
| // Checks (via an assert in `compiler/rustc_ty_utils/src/abi.rs`) that the C ABI for the current | ||
| // target correctly implements `rustc_pass_indirectly_in_non_rustic_abis`. | ||
| #[cfg(not(target_arch = "spirv"))] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should comment on the "upstream" PR because this is present from there.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw support for variadics in spirv functions landed recently llvm/llvm-project#175076 |
||
| const _: () = { | ||
| #[repr(C)] | ||
| #[rustc_pass_indirectly_in_non_rustic_abis] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure I agree with SPIRV being SpirV in the
Archbut let's be consistent here. TheArchKind::Riscvdeviation was not an intentional choice, if memory serves.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with
Spirveverywhere then. But that'd have to be fixed in the "upstream" PR as well.