-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][ESIMD] Fix compilation break occurring when bfloat16 constructor is used in a kernel #8892
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7c717cc
Add lowering of __devicelib_Convert* functions to their spirv counter…
fineg74 6839bcb
Add comments
fineg74 339def7
Merge branches 'sycl' and 'bfloat16ConstructorFix' of https://github.…
fineg74 313ddf4
Merge remote-tracking branch 'origin/sycl' into bfloat16ConstructorFix
fineg74 6cbf006
Fix a build break
fineg74 9b27111
Add test to verify the fix
fineg74 ef37c10
Fix clang-format artefacts
fineg74 72308eb
Fix clang-format artefact
fineg74 f510e70
Merge remote-tracking branch 'origin/sycl' into bfloat16ConstructorFix
fineg74 686344c
Fix clang-format issue
fineg74 e9403f4
Fix failing unit test
fineg74 a89c1cf
Merge remote-tracking branch 'origin/sycl' into bfloat16ConstructorFix
fineg74 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// REQUIRES: gpu | ||
// UNSUPPORTED: gpu-intel-gen9 || cuda || hip | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
// XFAIL: gpu && !esimd_emulator | ||
//==- bfloat16Constructor.cpp - Test to verify use of bfloat16 constructor -==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// This is basic test to verify use of bfloat16 constructor in kernel. | ||
// TODO: Enable the test once the GPU RT supporting the functionality reaches | ||
// the CI | ||
|
||
#include <CL/sycl.hpp> | ||
#include <ext/intel/esimd.hpp> | ||
#include <iostream> | ||
|
||
using namespace sycl; | ||
|
||
int main() { | ||
constexpr unsigned Size = 32; | ||
constexpr unsigned VL = 32; | ||
constexpr unsigned GroupSize = 1; | ||
|
||
queue q; | ||
auto dev = q.get_device(); | ||
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n"; | ||
auto *C = malloc_shared<float>(Size * sizeof(float), dev, q.get_context()); | ||
|
||
for (auto i = 0; i != Size; i++) { | ||
C[i] = 7; | ||
} | ||
|
||
nd_range<1> Range(range<1>(Size / VL), range<1>(GroupSize)); | ||
|
||
auto e = q.submit([&](handler &cgh) { | ||
cgh.parallel_for<class Test>(Range, [=](nd_item<1> i) SYCL_ESIMD_KERNEL { | ||
using bf16 = sycl::ext::oneapi::bfloat16; | ||
using namespace __ESIMD_NS; | ||
using namespace __ESIMD_ENS; | ||
simd<bf16, 32> data_bf16 = bf16(0); | ||
simd<float, 32> data = data_bf16; | ||
lsc_block_store<float, 32>(C, data); | ||
}); | ||
}); | ||
e.wait(); | ||
bool Pass = true; | ||
for (auto i = 0; i != Size; i++) { | ||
if (C[i] != 0) { | ||
Pass = false; | ||
} | ||
} | ||
|
||
free(C, q); | ||
std::cout << (Pass ? "Test Passed\n" : "Test FAILED\n"); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.