Skip to content

Commit

Permalink
unsupported test on win. fix trim balance
Browse files Browse the repository at this point in the history
  • Loading branch information
cperkinsintel committed Jul 12, 2024
1 parent 6600045 commit 84c93ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
18 changes: 14 additions & 4 deletions sycl/source/detail/kernel_bundle_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,21 @@ class kernel_bundle_impl {
}

std::string trimXsFlags(std::string &str) {
auto start = std::find_if(str.begin(), str.end(), [](char c) {
return !std::isspace(c) && c != '\'' && c != '"';
// trim first and last quote if they exist, but no others.
char encounteredQuote = '\0';
auto start = std::find_if(str.begin(), str.end(), [&](char c) {
if (!encounteredQuote && (c == '\'' || c == '"')) {
encounteredQuote = c;
return false;
}
return !std::isspace(c);
});
auto end = std::find_if(str.rbegin(), str.rend(), [](char c) {
return !std::isspace(c) && c != '\'' && c != '"';
auto end = std::find_if(str.rbegin(), str.rend(), [&](char c) {
if (c == encounteredQuote) {
encounteredQuote = '\0';
return false;
}
return !std::isspace(c);
}).base();
if (start != std::end(str) && end != std::begin(str) && start < end) {
return std::string(start, end);
Expand Down
9 changes: 6 additions & 3 deletions sycl/test-e2e/KernelCompiler/sycl_device_flags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
//===----------------------------------------------------------------------===//

// REQUIRES: level_zero
// UNSUPPORTED: windows

// IGC shader dump not available on Windows

// RUN: %{build} -o %t.out
// RUN: env IGC_DumpToCustomDir=%t.dump IGC_ShaderDumpEnable=1 NEO_CACHE_PERSISTENT=0 %{run} %t.out
// RUN: grep -ze-exp-register-file-size=256 %t.dump/OCL_asmaf99e2d4667ef6d3_options.txt
// RUN: grep -e '-doubleGRF' %t.dump/OCL_asmaf99e2d4667ef6d3_options.txt

// clang-format off
/*
clang++ -fsycl -o sdf.bin sycl_device_flags.cpp
IGC_ShaderDumpEnable=1 IGC_DumpToCustomDir=./dump NEO_CACHE_PERSISTENT=0 ./sdf.bin
grep -ze-exp-register-file-size=256 ./dump/OCL_asmaf99e2d4667ef6d3_options.txt
grep -e '-doubleGRF' ./dump/OCL_asmaf99e2d4667ef6d3_options.txt
Note: there are files named xxx_options.txt and xxx_internal_options.txt in
the IGC dump directory. The file with "internal_options.txt" is NOT the
Expand Down Expand Up @@ -77,7 +80,7 @@ int main() {
source_kb kbSrc = syclex::create_kernel_bundle_from_source(
ctx, syclex::source_language::sycl, SYCLSource);

std::vector<std::string> flags{"-Xs '-ze-exp-register-file-size=256'"};
std::vector<std::string> flags{"-Xs '-doubleGRF'"};
exe_kb kbExe =
syclex::build(kbSrc, syclex::properties{syclex::build_options{flags}});

Expand Down

0 comments on commit 84c93ed

Please sign in to comment.