Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions crates/core_arch/src/aarch64/mte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ unsafe extern "llvm-intrinsic" {
fn subp_(ptr_a: *const (), ptr_b: *const ()) -> i64;
}

/// Return a pointer containing a randomly generated logical address tag.
/// Returns a pointer containing a randomly generated logical address tag.
///
/// `src`: A pointer containing an address.
/// `mask`: A mask where each of the lower 16 bits specifies logical
Expand All @@ -38,7 +38,7 @@ pub unsafe fn __arm_mte_create_random_tag<T>(src: *const T, mask: u64) -> *const
irg_(src as *const (), mask as i64) as *const T
}

/// Return a pointer with the logical address tag offset by a value.
/// Returns a pointer with the logical address tag offset by a value.
///
/// `src`: A pointer containing an address and a logical tag.
/// `OFFSET`: A compile-time constant value in the range [0, 15].
Expand All @@ -54,7 +54,7 @@ pub unsafe fn __arm_mte_increment_tag<const OFFSET: i64, T>(src: *const T) -> *c
addg_(src as *const (), OFFSET) as *const T
}

/// Add a logical tag to the set of excluded logical tags.
/// Adds a logical tag to the set of excluded logical tags.
///
/// `src`: A pointer containing an address and a logical tag.
/// `excluded`: A mask where the lower 16 bits each specify currently-excluded
Expand All @@ -69,7 +69,7 @@ pub unsafe fn __arm_mte_exclude_tag<T>(src: *const T, excluded: u64) -> u64 {
gmi_(src as *const (), excluded as i64) as u64
}

/// Store an allocation tag for the 16-byte granule of memory.
/// Stores an allocation tag for the 16-byte granule of memory.
///
/// `tag_address`: A pointer containing an address and a logical tag, which
/// must be 16-byte aligned.
Expand All @@ -83,7 +83,7 @@ pub unsafe fn __arm_mte_set_tag<T>(tag_address: *const T) {
stg_(tag_address as *const (), tag_address as *const ());
}

/// Load an allocation tag from memory, returning a new pointer with the
/// Loads an allocation tag from memory, returning a new pointer with the
/// corresponding logical tag.
///
/// `address`: A pointer containing an address from which allocation tag memory
Expand All @@ -95,7 +95,7 @@ pub unsafe fn __arm_mte_get_tag<T>(address: *const T) -> *const T {
ldg_(address as *const (), address as *const ()) as *const T
}

/// Calculate the difference between the address parts of two pointers, ignoring
/// Calculates the difference between the address parts of two pointers, ignoring
/// the tags, and sign-extending the result.
#[inline]
#[target_feature(enable = "mte")]
Expand Down
14 changes: 7 additions & 7 deletions crates/core_arch/src/aarch64/prefetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ unsafe extern "llvm-intrinsic" {
fn prefetch(p: *const i8, rw: i32, loc: i32, ty: i32);
}

/// See [`prefetch`](fn._prefetch.html).
/// See [`_prefetch`].
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_READ: i32 = 0;

/// See [`prefetch`](fn._prefetch.html).
/// See [`_prefetch`].
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_WRITE: i32 = 1;

/// See [`prefetch`](fn._prefetch.html).
/// See [`_prefetch`].
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY0: i32 = 0;

/// See [`prefetch`](fn._prefetch.html).
/// See [`_prefetch`].
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY1: i32 = 1;

/// See [`prefetch`](fn._prefetch.html).
/// See [`_prefetch`].
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY2: i32 = 2;

/// See [`prefetch`](fn._prefetch.html).
/// See [`_prefetch`].
#[unstable(feature = "stdarch_aarch64_prefetch", issue = "117217")]
pub const _PREFETCH_LOCALITY3: i32 = 3;

/// Fetch the cache line that contains address `p` using the given `RW` and `LOCALITY`.
/// Fetches the cache line that contains address `p` using the given `RW` and `LOCALITY`.
///
/// The `RW` must be one of:
///
Expand Down
67 changes: 42 additions & 25 deletions crates/core_arch/src/amdgpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,14 @@ unsafe extern "llvm-intrinsic" {
pub fn workitem_id_x() -> u32 {
llvm_workitem_id_x()
}

/// Returns the y coordinate of the workitem index within the workgroup.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub fn workitem_id_y() -> u32 {
llvm_workitem_id_y()
}

/// Returns the z coordinate of the workitem index within the workgroup.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
Expand All @@ -206,12 +208,14 @@ pub fn workitem_id_z() -> u32 {
pub fn workgroup_id_x() -> u32 {
llvm_workgroup_id_x()
}

/// Returns the y coordinate of the workgroup index within the dispatch.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub fn workgroup_id_y() -> u32 {
llvm_workgroup_id_y()
}

/// Returns the z coordinate of the workgroup index within the dispatch.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
Expand All @@ -225,6 +229,7 @@ pub fn workgroup_id_z() -> u32 {
pub fn groupstaticsize() -> u32 {
llvm_groupstaticsize()
}

/// Returns the id of the dispatch that is currently executed.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
Expand All @@ -241,7 +246,7 @@ pub fn wavefrontsize() -> u32 {
llvm_wavefrontsize()
}

/// Synchronize all wavefronts in a workgroup.
/// Synchronizes all wavefronts in a workgroup.
///
/// Each wavefronts in a workgroup waits at the barrier until all wavefronts in the workgroup arrive at a barrier.
///
Expand All @@ -252,7 +257,7 @@ pub fn s_barrier() {
llvm_s_barrier()
}

/// Signal a specific barrier type.
/// Signals a specific barrier type.
///
/// Only for non-named barriers.
///
Expand All @@ -263,7 +268,7 @@ pub unsafe fn s_barrier_signal<const BARRIER_TYPE: i32>() {
unsafe { llvm_s_barrier_signal(BARRIER_TYPE) }
}

/// Signal a specific barrier type.
/// Signals a specific barrier type.
///
/// Only for non-named barriers.
/// Provides access to the s_barrier_signal_first instruction;
Expand All @@ -277,7 +282,7 @@ pub unsafe fn s_barrier_signal_isfirst<const BARRIER_TYPE: i32>() -> bool {
unsafe { llvm_s_barrier_signal_isfirst(BARRIER_TYPE) }
}

/// Wait for a specific barrier type.
/// Waits for a specific barrier type.
///
/// Only for non-named barriers.
///
Expand All @@ -288,7 +293,7 @@ pub unsafe fn s_barrier_wait<const BARRIER_TYPE: i16>() {
unsafe { llvm_s_barrier_wait(BARRIER_TYPE) }
}

/// Get the state of a specific barrier type.
/// Gets the state of a specific barrier type.
///
/// The `barrier_type` argument must be uniform, otherwise behavior is undefined.
///
Expand All @@ -310,7 +315,7 @@ pub fn wave_barrier() {
llvm_wave_barrier()
}

/// Prevent movement of some instruction types.
/// Prevents movement of some instruction types.
///
/// Controls the types of instructions that may be allowed to cross the intrinsic during instruction scheduling.
/// The parameter is a mask for the instruction types that can cross the intrinsic.
Expand Down Expand Up @@ -380,7 +385,7 @@ pub fn s_sleep<const COUNT: u32>() {
llvm_s_sleep(COUNT)
}

/// Stop execution of the kernel.
/// Stops execution of the kernel.
///
/// This usually signals an error state.
///
Expand Down Expand Up @@ -413,6 +418,7 @@ pub fn s_getpc() -> i64 {
pub fn mbcnt_lo(value: u32, init: u32) -> u32 {
llvm_mbcnt_lo(value, init)
}

/// Masked bit count, high 32 lanes.
///
/// Computes the number of bits set in `value`, masked with a thread mask
Expand Down Expand Up @@ -464,6 +470,7 @@ pub fn wave_reduce_umin<const STRATEGY: u32>(value: u32) -> u32 {
static_assert!(STRATEGY <= 2);
llvm_wave_reduce_umin(value, STRATEGY)
}

/// Performs an arithmetic min reduction on the signed values provided by each lane in the wavefront.
///
/// The `STRATEGY` argument is a hint for the reduction strategy.
Expand Down Expand Up @@ -497,6 +504,7 @@ pub fn wave_reduce_umax<const STRATEGY: u32>(value: u32) -> u32 {
static_assert!(STRATEGY <= 2);
llvm_wave_reduce_umax(value, STRATEGY)
}

/// Performs an arithmetic max reduction on the signed values provided by each lane in the wavefront.
///
/// The `STRATEGY` argument is a hint for the reduction strategy.
Expand Down Expand Up @@ -547,6 +555,7 @@ pub fn wave_reduce_and<const STRATEGY: u32>(value: u32) -> u32 {
static_assert!(STRATEGY <= 2);
llvm_wave_reduce_and(value, STRATEGY)
}

/// Performs a logical or reduction on the unsigned values provided by each lane in the wavefront.
///
/// The `STRATEGY` argument is a hint for the reduction strategy.
Expand All @@ -563,6 +572,7 @@ pub fn wave_reduce_or<const STRATEGY: u32>(value: u32) -> u32 {
static_assert!(STRATEGY <= 2);
llvm_wave_reduce_or(value, STRATEGY)
}

/// Performs a logical xor reduction on the unsigned values provided by each lane in the wavefront.
///
/// The `STRATEGY` argument is a hint for the reduction strategy.
Expand All @@ -582,23 +592,25 @@ pub fn wave_reduce_xor<const STRATEGY: u32>(value: u32) -> u32 {

// The following intrinsics can have multiple sizes

/// Get `value` from the first active lane in the wavefront.
/// Gets `value` from the first active lane in the wavefront.
///
#[doc = include_str!("intrinsic_is_convergent.md")]
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub fn readfirstlane_u32(value: u32) -> u32 {
llvm_readfirstlane_u32(value)
}
/// Get `value` from the first active lane in the wavefront.

/// Gets `value` from the first active lane in the wavefront.
///
#[doc = include_str!("intrinsic_is_convergent.md")]
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub fn readfirstlane_u64(value: u64) -> u64 {
llvm_readfirstlane_u64(value)
}
/// Get `value` from the lane at index `lane` in the wavefront.

/// Gets `value` from the lane at index `lane` in the wavefront.
///
/// The lane argument must be uniform across the currently active threads
/// of the current wavefront. Otherwise, the result is undefined.
Expand All @@ -609,7 +621,8 @@ pub fn readfirstlane_u64(value: u64) -> u64 {
pub unsafe fn readlane_u32(value: u32, lane: u32) -> u32 {
unsafe { llvm_readlane_u32(value, lane) }
}
/// Get `value` from the lane at index `lane` in the wavefront.

/// Gets `value` from the lane at index `lane` in the wavefront.
///
/// The lane argument must be uniform across the currently active threads
/// of the current wavefront. Otherwise, the result is undefined.
Expand All @@ -620,8 +633,9 @@ pub unsafe fn readlane_u32(value: u32, lane: u32) -> u32 {
pub unsafe fn readlane_u64(value: u64, lane: u32) -> u64 {
unsafe { llvm_readlane_u64(value, lane) }
}
/// Return `value` for the lane at index `lane` in the wavefront.
/// Return `default` for all other lanes.

/// Returns `value` for the lane at index `lane` in the wavefront.
/// Returns `default` for all other lanes.
///
/// The value to write and lane select arguments must be uniform across the
/// currently active threads of the current wavefront. Otherwise, the result is
Expand All @@ -636,8 +650,9 @@ pub unsafe fn readlane_u64(value: u64, lane: u32) -> u64 {
pub unsafe fn writelane_u32(value: u32, lane: u32, default: u32) -> u32 {
unsafe { llvm_writelane_u32(value, lane, default) }
}
/// Return `value` for the lane at index `lane` in the wavefront.
/// Return `default` for all other lanes.

/// Returns `value` for the lane at index `lane` in the wavefront.
/// Returns `default` for all other lanes.
///
/// The value to write and lane select arguments must be uniform across the
/// currently active threads of the current wavefront. Otherwise, the result is
Expand All @@ -653,7 +668,7 @@ pub unsafe fn writelane_u64(value: u64, lane: u32, default: u64) -> u64 {
unsafe { llvm_writelane_u64(value, lane, default) }
}

/// Stop execution of the wavefront.
/// Stops execution of the wavefront.
///
/// This usually signals the end of a successful execution.
///
Expand All @@ -664,7 +679,7 @@ pub fn endpgm() -> ! {
llvm_endpgm()
}

/// The `update_dpp` intrinsic represents the `update.dpp` operation in AMDGPU.
/// Represents the `update.dpp` operation in AMDGPU.
/// It takes an old value, a source operand, a DPP control operand, a row mask, a bank mask, and a bound control.
/// This operation is equivalent to a sequence of `v_mov_b32` operations.
///
Expand Down Expand Up @@ -700,7 +715,7 @@ pub fn s_memrealtime() -> u64 {
llvm_s_memrealtime()
}

/// Scatter data across all lanes in a wavefront.
/// Scatters data across all lanes in a wavefront.
///
/// Writes `value` to the lane addressed by `lane`.
///
Expand All @@ -715,7 +730,8 @@ pub fn s_memrealtime() -> u64 {
pub unsafe fn ds_permute(lane: u32, value: u32) -> u32 {
unsafe { llvm_ds_permute(lane, value) }
}
/// Gather data across all lanes in a wavefront.

/// Gathers data across all lanes in a wavefront.
///
/// Returns the `value` given to `ds_bpermute` by the lane addressed by `lane`.
///
Expand All @@ -729,7 +745,8 @@ pub unsafe fn ds_permute(lane: u32, value: u32) -> u32 {
pub unsafe fn ds_bpermute(lane: u32, value: u32) -> u32 {
unsafe { llvm_ds_bpermute(lane, value) }
}
/// Permute a 64-bit value.

/// Permutes a 64-bit value.
///
/// `selector` selects between different patterns in which the 64-bit values represented by `src0` and `src1` are permuted.
#[inline]
Expand Down Expand Up @@ -774,15 +791,15 @@ pub unsafe fn permlanex16_u32<const FI: bool, const BOUND_CONTROL: bool>(
unsafe { llvm_permlanex16_u32(old, src0, src1, src2, FI, BOUND_CONTROL) }
}

/// Get the index of the current wavefront in the workgroup.
/// Gets the index of the current wavefront in the workgroup.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub fn s_get_waveid_in_workgroup() -> u32 {
llvm_s_get_waveid_in_workgroup()
}

// gfx11
/// Swap `value` between upper and lower 32 lanes in a wavefront.
/// Swaps `value` between upper and lower 32 lanes in a wavefront.
///
/// Does nothing for wave32.
///
Expand Down Expand Up @@ -825,15 +842,15 @@ pub unsafe fn permlanex16_var<const FI: bool, const BOUND_CONTROL: bool>(
unsafe { llvm_permlanex16_var(old, src0, src1, FI, BOUND_CONTROL) }
}

/// Get the index of the current wavefront in the workgroup.
/// Gets the index of the current wavefront in the workgroup.
#[inline]
#[unstable(feature = "stdarch_amdgpu", issue = "149988")]
pub fn wave_id() -> u32 {
llvm_wave_id()
}

// gfx950
/// Provide direct access to `v_permlane16_swap_b32` instruction on supported targets.
/// Provides direct access to `v_permlane16_swap_b32` instruction on supported targets.
///
/// Swaps the values across lanes of first 2 operands.
/// Odd rows of the first operand are swapped with even rows of the second operand (one row is 16 lanes).
Expand All @@ -851,7 +868,7 @@ pub unsafe fn permlane16_swap<const FI: bool, const BOUND_CONTROL: bool>(
}

// gfx950
/// Provide direct access to `v_permlane32_swap_b32` instruction on supported targets.
/// Provides direct access to `v_permlane32_swap_b32` instruction on supported targets.
///
/// Swaps the values across lanes of first 2 operands.
/// Rows 2 and 3 of the first operand are swapped with rows 0 and 1 of the second operand (one row is 16 lanes).
Expand Down
Loading
Loading