Skip to content

Commit 56a5e5a

Browse files
committed
applied comments, moved to source directory and update test to check
side effects of env var. Signed-off-by: Vlad Romanov <[email protected]>
1 parent cb46557 commit 56a5e5a

File tree

6 files changed

+25
-152
lines changed

6 files changed

+25
-152
lines changed

sycl/include/CL/sycl/detail/config.def

Lines changed: 0 additions & 14 deletions
This file was deleted.

sycl/include/CL/sycl/detail/config.hpp

Lines changed: 0 additions & 103 deletions
This file was deleted.

sycl/source/detail/config.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <CL/sycl/detail/config.hpp>
9+
#include <detail/config.hpp>
1010

1111
#include <cstring>
1212
#include <fstream>
@@ -20,17 +20,17 @@ namespace cl {
2020
namespace sycl {
2121
namespace detail {
2222

23-
#ifndef SYCL_CONFIG_NAME
24-
#define SYCL_CONFIG_NAME sycl.cfg
25-
#endif // SYCL_CONFIG_NAME
23+
#ifndef SYCL_CONFIG_FILE_NAME
24+
#define SYCL_CONFIG_FILE_NAME "sycl.cfg"
25+
#endif // SYCL_CONFIG_FILE_NAME
2626

2727
#define CONFIG(Name, MaxSize, CompileTimeDef) \
2828
const char *SYCLConfigBase<Name>::MValueFromFile = nullptr; \
2929
char SYCLConfigBase<Name>::MStorage[MaxSize]; \
3030
const char *const SYCLConfigBase<Name>::MCompileTimeDef = \
3131
getStrOrNullptr(STRINGIFY_LINE(CompileTimeDef)); \
3232
const char *const SYCLConfigBase<Name>::MConfigName = STRINGIFY_LINE(Name);
33-
#include <CL/sycl/detail/config.def>
33+
#include <detail/config.def>
3434
#undef CONFIG
3535

3636
#define MAX_CONFIG_NAME 256
@@ -42,7 +42,7 @@ static void initValue(const char *Key, const char *Value) {
4242
SYCLConfigBase<Name>::MValueFromFile = SYCLConfigBase<Name>::MStorage; \
4343
return; \
4444
}
45-
#include <CL/sycl/detail/config.def>
45+
#include <detail/config.def>
4646
#undef CONFIG
4747
}
4848

@@ -52,9 +52,8 @@ void readConfig() {
5252
return;
5353
std::fstream File;
5454
// TODO: Find libsycl.so location.
55-
static const char *ConfigFile = getenv("SYCL_CONFIG_FILE");
56-
const char *FileToLoad =
57-
ConfigFile ? ConfigFile : STRINGIFY_LINE(SYCL_CONFIG_NAME);
55+
static const char *ConfigFile = getenv("SYCL_CONFIG_FILE_NAME");
56+
const char *FileToLoad = ConfigFile ? ConfigFile : SYCL_CONFIG_FILE_NAME;
5857
File.open(FileToLoad, std::ios::in);
5958
if (File.is_open()) {
6059
// TODO: Use max size from macro instead of 256
@@ -93,7 +92,7 @@ void dumpConfig() {
9392
const char *Val = SYCLConfig<Name>::get(); \
9493
std::cerr << SYCLConfigBase<Name>::MConfigName << " : " \
9594
<< (Val ? Val : "unset") << std::endl;
96-
#include <CL/sycl/detail/config.def>
95+
#include <detail/config.def>
9796
#undef CONFIG
9897
}
9998

sycl/source/detail/scheduler/graph_builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <CL/sycl/access/access.hpp>
10-
#include <CL/sycl/detail/config.hpp>
10+
#include <detail/config.hpp>
1111
#include <CL/sycl/detail/event_impl.hpp>
1212
#include <CL/sycl/detail/memory_manager.hpp>
1313
#include <CL/sycl/detail/queue_impl.hpp>

sycl/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ configure_lit_site_cfg(
2929
list(APPEND SYCL_TEST_DEPS
3030
sycl-toolchain
3131
FileCheck
32+
not
3233
get_device_count_by_type
3334
llvm-config
3435
)

sycl/test/config/config.cpp

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,22 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
// RUN: %clangxx -g -O0 -fsycl %s -o %t1.out
9-
// RUN: %clangxx -g -O0 -fsycl %s -o %t2.out
10-
// RUN: echo "SYCL_PRINT_EXECUTION_GRAPH=ValueFromConfigFile" > %t3.cfg
11-
// RUN: env SYCL_CONFIG_FILE=%t3.cfg env SYCL_PRINT_EXECUTION_GRAPH=VlaueFromEnvVar %t1.out
12-
// RUN: env SYCL_CONFIG_FILE=%t3.cfg %t1.out
13-
// RUN: %t2.out
8+
// RUN: %clangxx -g -O0 -fsycl %s -o %t.out
9+
// RUN: echo "SYCL_PRINT_EXECUTION_GRAPH=always" > %t.cfg
10+
// RUN: env SYCL_CONFIG_FILE_NAME=%t.cfg %t.out
11+
// RUN: ls | grep dot
12+
// RUN: rm *.dot
13+
// RUN: env SYCL_PRINT_EXECUTION_GRAPH=always %t.out
14+
// RUN: ls | grep dot
15+
// RUN: rm *.dot
16+
// RUN: %t.out
17+
// RUN: ls | not grep dot
1418

15-
#include <CL/sycl/detail/config.hpp>
19+
#include <CL/sycl.hpp>
1620

17-
#include <cstring>
21+
using namespace cl;
1822

1923
int main() {
20-
const char *Val = cl::sycl::detail::SYCLConfig<
21-
cl::sycl::detail::SYCL_PRINT_EXECUTION_GRAPH>::get();
22-
23-
if (getenv("SYCL_PRINT_EXECUTION_GRAPH")) {
24-
if (!Val)
25-
return 1;
26-
return strcmp(Val, "VlaueFromEnvVar");
27-
}
28-
29-
if (getenv("SYCL_CONFIG_FILE")) {
30-
if(!Val)
31-
return 1;
32-
return strcmp(Val, "ValueFromConfigFile");
33-
}
34-
35-
return nullptr != Val;
24+
sycl::buffer<int, 1> Buf(sycl::range<1>{1});
25+
auto Acc = Buf.get_access<sycl::access::mode::read>();
3626
}

0 commit comments

Comments
 (0)