Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL][L0] Support for >4Gb device allocations. #298

Merged
merged 3 commits into from
Jun 3, 2021
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
43 changes: 43 additions & 0 deletions SYCL/Plugin/max_malloc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// REQUIRES: gpu, level_zero, level_zero_dev_kit
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out
// RUN: env SYCL_PROGRAM_COMPILE_OPTIONS=-ze-intel-greater-than-4GB-buffer-required %GPU_RUN_PLACEHOLDER %t.out

#include <CL/sycl.hpp>
#include <iostream>

using namespace cl::sycl;

const double Gb = 1024 * 1024 * 1024;

int main() {
auto D = device(gpu_selector());

std::cout << "name = " << D.get_info<info::device::name>() << std::endl;

auto global_mem_size = D.get_info<info::device::global_mem_size>() / Gb;
std::cout << "global_mem_size = " << global_mem_size << std::endl;
std::cout << "max_mem_alloc_size = "
<< D.get_info<info::device::max_mem_alloc_size>() / Gb << std::endl;

auto Q = queue(D);
for (int I = 1; I < global_mem_size; I++) {
void *p;
p = malloc_device(I * Gb, Q);
std::cout << "malloc_device(" << I << "Gb) = " << p << std::endl;
if (p == nullptr) {
std::cout << "FAILED" << std::endl;
return -1;
}
sycl::free(p, Q);

p = malloc_shared(I * Gb, Q);
std::cout << "malloc_shared(" << I << "Gb) = " << p << std::endl;
if (p == nullptr) {
std::cout << "FAILED" << std::endl;
return -1;
}
sycl::free(p, Q);
}

return 0;
}
3 changes: 3 additions & 0 deletions SYCL/USM/badmalloc.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// UNSUPPORTED: windows
//
// XFAIL: level_zero
// TODO: enable the test when L0 driver is honoring too large sizes.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: %HOST_RUN_PLACEHOLDER %t1.out
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
Expand Down