Skip to content

Add unit test for FP16 MMA #368

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

Open
wants to merge 23 commits into
base: sycl-develop
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ option(CUTLASS_SYCL_PROFILING_ENABLED "Use SYCL events to calculate device execu
option(CUTLASS_SYCL_RUNNING_CI "Enable this option when building in a CI environment.
It activates CI specific configurations, such as additional checks or selectively
disabling tests that cannot run in CI." OFF)
option(CUTLASS_SYCL_BUILTIN_ENABLE "Enable this option to use builtin functions instead of SPIR-V" OFF)

if (CUTLASS_ENABLE_SYCL)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand All @@ -130,6 +132,10 @@ if (CUTLASS_ENABLE_SYCL)
add_compile_definitions(SYCLCOMPAT_PROFILING_ENABLED)
endif()

if (CUTLASS_SYCL_BUILTIN_ENABLE)
add_compile_definitions(CUTLASS_SYCL_BUILTIN_ENABLE)
endif()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/onemkl.cmake)
endif()
find_package(Doxygen QUIET)
Expand Down
7 changes: 5 additions & 2 deletions cmake/FindDPCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ endif()
if("${DPCPP_SYCL_TARGET}" STREQUAL "intel_gpu_pvc" OR
"${DPCPP_SYCL_TARGET}" STREQUAL "spir64" OR
"${DPCPP_SYCL_TARGET}" STREQUAL "intel_gpu_bmg_g21")
list(APPEND DPCPP_FLAGS "-Xspirv-translator;-spirv-ext=+SPV_INTEL_split_barrier")

if ((CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2025.2) OR CUTLASS_SYCL_BUILTIN_ENABLE)
list(APPEND DPCPP_FLAGS "-Xspirv-translator;-spirv-ext=+SPV_INTEL_split_barrier")
else()
list(APPEND DPCPP_FLAGS "-Xspirv-translator;-spirv-ext=+SPV_INTEL_split_barrier,+SPV_INTEL_2d_block_io,+SPV_INTEL_subgroup_matrix_multiply_accumulate")
endif()
if(DPCPP_DISABLE_ITT_FOR_CUTLASS)
list(APPEND DPCPP_FLAGS "-fno-sycl-instrument-device-code")
endif()
Expand Down
100 changes: 14 additions & 86 deletions include/cute/arch/copy_xe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,22 @@
*
**************************************************************************************************/
#pragma once
#include <cute/arch/xe_copy_1B.hpp>
#include <cute/arch/xe_copy_2B.hpp>
#include <cute/arch/xe_copy_4B.hpp>
#include <cute/arch/xe_copy_8B.hpp>
#ifdef __SYCL_DEVICE_ONLY__
#define SYCL_DEVICE_BUILTIN(x) SYCL_EXTERNAL extern "C" x
#else
#define SYCL_DEVICE_BUILTIN(x) inline x { assert(false); }

#if defined(__SYCL_DEVICE_ONLY__) && defined(SYCL_INTEL_TARGET)
#define CUTE_ARCH_COPY_XE_ENABLED
#endif

#if defined(CUTE_ARCH_COPY_XE_ENABLED) && ((defined(__INTEL_LLVM_COMPILER) && (__INTEL_LLVM_COMPILER < 20250200)) || defined(CUTLASS_SYCL_BUILTIN_ENABLE))
#include <cute/arch/copy_xe_builtin.hpp>
#elif defined(CUTE_ARCH_COPY_XE_ENABLED)
#include <cute/arch/copy_xe_spirv.hpp>
#endif

// prefetch
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_uchar(
const __attribute__((opencl_global)) uint8_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_ushort(
const __attribute__((opencl_global)) uint16_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_uint(
const __attribute__((opencl_global)) uint32_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_uint2(
const __attribute__((opencl_global)) uint32_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_uint4(
const __attribute__((opencl_global)) uint32_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_uint8(
const __attribute__((opencl_global)) uint32_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_ulong(
const __attribute__((opencl_global)) uint64_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_ulong2(
const __attribute__((opencl_global)) uint64_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_ulong4(
const __attribute__((opencl_global)) uint64_t *base, int immElemOff,
enum CacheControl cacheOpt));
SYCL_DEVICE_BUILTIN(void __builtin_IB_lsc_prefetch_global_ulong8(
const __attribute__((opencl_global)) uint64_t *base, int immElemOff,
enum CacheControl cacheOpt));
#undef SYCL_DEVICE_BUILTIN
#include <cute/arch/copy_xe_U4.hpp>
#include <cute/arch/copy_xe_U8.hpp>
#include <cute/arch/copy_xe_U16.hpp>
#include <cute/arch/copy_xe_U32.hpp>
#include <cute/arch/copy_xe_U64.hpp>

#ifdef __SYCL_DEVICE_ONLY__
SYCL_EXTERNAL __attribute__((convergent)) void __spirv_ControlBarrierWaitINTEL(int execution_scope, int memory_scope, int memory_semantics);
Expand Down Expand Up @@ -142,49 +116,6 @@ struct XE_1D_LDSM {
}
};

template <class S, class D = S>
struct PREFETCH {
using SRegisters = S[1];
using DRegisters = D[1];

template <class S_, class D_>
CUTE_HOST_DEVICE static void copy(const S_ &src, D_ &dst) {
#if defined(SYCL_INTEL_TARGET)
if constexpr(sizeof(D) == 1) {
__builtin_IB_lsc_prefetch_global_uchar(
(const __attribute__((opencl_global)) uint8_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
else if constexpr(sizeof(D) == 2) {
__builtin_IB_lsc_prefetch_global_ushort(
(const __attribute__((opencl_global)) uint16_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
else if constexpr(sizeof(D) == 4) {
__builtin_IB_lsc_prefetch_global_uint(
(const __attribute__((opencl_global)) uint32_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
else if constexpr(sizeof(D) == 8) {
__builtin_IB_lsc_prefetch_global_uint2(
(const __attribute__((opencl_global)) uint32_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
else if constexpr(sizeof(D) == 16) {
__builtin_IB_lsc_prefetch_global_uint4(
(const __attribute__((opencl_global)) uint32_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
else if constexpr(sizeof(D) == 32) {
__builtin_IB_lsc_prefetch_global_uint8(
(const __attribute__((opencl_global)) uint32_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
else if constexpr(sizeof(D) == 64) {
__builtin_IB_lsc_prefetch_global_ulong8(
(const __attribute__((opencl_global)) uint64_t *)(&*&src), 0, CacheControl::kL1C_L3C);
}
#else
CUTE_INVALID_CONTROL_PATH(
"Trying to use block prefetch on non-Xe hardware");
#endif
}
};

template <class S, class D = S>
struct XE_1D_LOAD_GLOBAL {
using SRegisters = S[1];
Expand Down Expand Up @@ -212,9 +143,6 @@ struct XE_1D_LOAD_GLOBAL {
CUTE_INVALID_CONTROL_PATH("Trying to use block loads on non-Xe hardware");
#endif
}

using PREFETCH = PREFETCH<S, D>;

};

template<class S, class D = S>
Expand Down
Loading
Loading