Skip to content

Commit 5ef8df8

Browse files
authored
[SYCL][ESIMD] Implement unified memory API - atomic_update(acc,...) zero operands (#11884)
This implements the compile-time properties version of atomic_update with accessors and zero operands. I moved the zero operand block to be before the one operand block, so hopefully it's easier to review. I didn't port the local accessor ones yet, I'll do that as part of the SLM change. I also moved the one and two operand intrinsics to supported even though they aren't used by and supported code yet, it's just preparing for the next change. I also fixed some typos in the usm version doc. --------- Signed-off-by: Sarnie, Nick <[email protected]>
1 parent ff61613 commit 5ef8df8

File tree

10 files changed

+843
-382
lines changed

10 files changed

+843
-382
lines changed

sycl/include/sycl/ext/intel/esimd/detail/memory_intrin.hpp

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,116 @@ __esimd_lsc_xatomic_stateless_2(
502502
}
503503
#endif // __SYCL_DEVICE_ONLY__
504504

505+
/// Accessor-based atomic.
506+
/// Supported platforms: DG2, PVC
507+
///
508+
/// @tparam Ty is element type.
509+
/// @tparam InternalOp is operation type.
510+
/// @tparam L1H is L1 cache hint.
511+
/// @tparam L2H is L2 cache hint.
512+
/// @tparam AddressScale is the address scale.
513+
/// @tparam ImmOffset is the immediate offset added to each address.
514+
/// @tparam DS is the data size.
515+
/// @tparam VS is the number of elements per address.
516+
/// @tparam Transposed indicates if the data is transposed during the transfer.
517+
/// @tparam N is the SIMD size of operation (the number of addresses to access)
518+
/// @tparam SurfIndAliasTy is the \ref sycl::accessor type.
519+
/// @param pred is predicates.
520+
/// @param offsets is the zero-based offsets.
521+
/// @param surf_ind is the surface index.
522+
template <typename Ty, int InternalOp, __ESIMD_NS::cache_hint L1H,
523+
__ESIMD_NS::cache_hint L2H, uint16_t AddressScale, int ImmOffset,
524+
__ESIMD_DNS::lsc_data_size DS, __ESIMD_DNS::lsc_vector_size VS,
525+
__ESIMD_DNS::lsc_data_order Transposed, int N,
526+
typename SurfIndAliasTy>
527+
__ESIMD_INTRIN __ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()>
528+
__esimd_lsc_xatomic_bti_0(__ESIMD_DNS::simd_mask_storage_t<N> pred,
529+
__ESIMD_DNS::vector_type_t<uint32_t, N> offsets,
530+
SurfIndAliasTy surf_ind)
531+
#ifdef __SYCL_DEVICE_ONLY__
532+
;
533+
#else // __SYCL_DEVICE_ONLY__
534+
{
535+
__ESIMD_UNSUPPORTED_ON_HOST;
536+
}
537+
#endif // __SYCL_DEVICE_ONLY__
538+
539+
/// Accessor-based atomic.
540+
/// Supported platforms: DG2, PVC
541+
///
542+
/// @tparam Ty is element type.
543+
/// @tparam InternalOp is operation type.
544+
/// @tparam L1H is L1 cache hint.
545+
/// @tparam L2H is L2 cache hint.
546+
/// @tparam AddressScale is the address scale.
547+
/// @tparam ImmOffset is the immediate offset added to each address.
548+
/// @tparam DS is the data size.
549+
/// @tparam VS is the number of elements per address.
550+
/// @tparam Transposed indicates if the data is transposed during the transfer.
551+
/// @tparam N is the SIMD size of operation (the number of addresses to access)
552+
/// @tparam SurfIndAliasTy is the \ref sycl::accessor type.
553+
/// @param pred is predicates.
554+
/// @param offsets is the zero-based offsets.
555+
/// @param src0 is the first atomic operand.
556+
/// @param surf_ind is the surface index.
557+
template <typename Ty, int InternalOp, __ESIMD_NS::cache_hint L1H,
558+
__ESIMD_NS::cache_hint L2H, uint16_t AddressScale, int ImmOffset,
559+
__ESIMD_DNS::lsc_data_size DS, __ESIMD_DNS::lsc_vector_size VS,
560+
__ESIMD_DNS::lsc_data_order _Transposed, int N,
561+
typename SurfIndAliasTy>
562+
__ESIMD_INTRIN __ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()>
563+
__esimd_lsc_xatomic_bti_1(
564+
__ESIMD_DNS::simd_mask_storage_t<N> pred,
565+
__ESIMD_DNS::vector_type_t<uint32_t, N> offsets,
566+
__ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()> src0,
567+
SurfIndAliasTy surf_ind)
568+
#ifdef __SYCL_DEVICE_ONLY__
569+
;
570+
#else // __SYCL_DEVICE_ONLY__
571+
{
572+
__ESIMD_UNSUPPORTED_ON_HOST;
573+
}
574+
#endif // __SYCL_DEVICE_ONLY__
575+
576+
/// Accessor-based atomic.
577+
/// Supported platforms: DG2, PVC
578+
///
579+
/// @tparam Ty is element type.
580+
/// @tparam InternalOp is operation type.
581+
/// @tparam L1H is L1 cache hint.
582+
/// @tparam L2H is L2 cache hint.
583+
/// @tparam AddressScale is the address scale.
584+
/// @tparam ImmOffset is the immediate offset added to each address.
585+
/// @tparam DS is the data size.
586+
/// @tparam VS is the number of elements per address.
587+
/// @tparam Transposed indicates if the data is transposed during the transfer.
588+
/// @tparam N is the SIMD size of operation (the number of addresses to access)
589+
/// @tparam SurfIndAliasTy is the \ref sycl::accessor type.
590+
/// @param pred is predicates.
591+
/// @param offsets is the zero-based offsets.
592+
/// @param src0 is the first atomic operand.
593+
/// @param src1 is the second atomic operand.
594+
/// @param surf_ind is the surface index.
595+
template <typename Ty, int InternalOp, __ESIMD_NS::cache_hint L1H,
596+
__ESIMD_NS::cache_hint L2H, uint16_t AddressScale, int ImmOffset,
597+
__ESIMD_DNS::lsc_data_size DS, __ESIMD_DNS::lsc_vector_size VS,
598+
__ESIMD_DNS::lsc_data_order Transposed, int N,
599+
typename SurfIndAliasTy>
600+
__ESIMD_INTRIN __ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()>
601+
__esimd_lsc_xatomic_bti_2(
602+
__ESIMD_DNS::simd_mask_storage_t<N> pred,
603+
__ESIMD_DNS::vector_type_t<uint32_t, N> offsets,
604+
__ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()> src0,
605+
__ESIMD_DNS::vector_type_t<Ty, N * __ESIMD_DNS::to_int<VS>()> src1,
606+
SurfIndAliasTy surf_ind)
607+
#ifdef __SYCL_DEVICE_ONLY__
608+
;
609+
#else // __SYCL_DEVICE_ONLY__
610+
{
611+
__ESIMD_UNSUPPORTED_ON_HOST;
612+
}
613+
#endif // __SYCL_DEVICE_ONLY__
614+
505615
__ESIMD_INTRIN void __esimd_slm_init(uint32_t size)
506616
#ifdef __SYCL_DEVICE_ONLY__
507617
;

0 commit comments

Comments
 (0)