Skip to content

Pure FP8 (W8A8) GEMM support (draft) #306

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 2 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 examples/sycl/pvc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ cutlass_example_add_executable(
TEST_BATCHES
)

cutlass_example_add_executable(
pvc_gemm_fp8
pvc_gemm_fp8.cpp
TEST_COMMAND_OPTIONS
TEST_BATCHES
)
cutlass_example_add_executable(
pvc_gemm_group
pvc_gemm_group.cpp
Expand Down
21 changes: 21 additions & 0 deletions examples/sycl/pvc/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@ bool initialize_block(
return true;
}

template<class LowElement, class HiElement>
void intialize_block(cutlass::DeviceAllocation<LowElement>& block_device, cutlass::DeviceAllocation<HiElement>& block_device_ref,
uint64_t seed, int M, int N) {
static_assert(cute::sizeof_bits_v<HiElement> > 8);
std::ranlux24_base rng(std::random_device{}());
rng.seed(seed);

using Limits = cutlass::platform::numeric_limits<LowElement>;
std::uniform_int_distribution<> dist(Limits::lowest(), Limits::max());

auto block_host = std::vector<LowElement>(block_device.size());
auto block_host_ref = std::vector<HiElement>(block_device_ref.size());
for (int i = 0; i < block_host.size(); i++) {
block_host[i] = static_cast<LowElement>(dist(rng));
block_host_ref[i]= static_cast<HiElement>(block_host[i]);
}

block_device.copy_from_host(block_host.data());
block_device_ref.copy_from_host(block_host_ref.data());
}

template <typename T1, typename T2>
void initialize_mixed_dtype_block(cutlass::DeviceAllocation<T1>& block_device,
cutlass::DeviceAllocation<T2>& block_device_dq,
Expand Down
Loading