Skip to content

Commit 02be83f

Browse files
Debug
1 parent 3187e3c commit 02be83f

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

sycl-jit/jit-compiler/lib/rtc/DeviceCompilation.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ using namespace llvm::util;
7272
using namespace llvm::vfs;
7373
using namespace jit_compiler;
7474

75+
#if defined(__linux__)
76+
#define PRETTY __PRETTY_FUNCTION__
77+
#else
78+
#define PRETTY __FUNCSIG__
79+
#endif
80+
7581
namespace {
7682
struct AutoPCHError : public ErrorInfo<AutoPCHError> {
7783
public:
@@ -282,6 +288,7 @@ class SYCLToolchain {
282288
std::unique_ptr<MemoryBuffer> PrecompiledPreamble,
283289
const PreambleBounds &Bounds, CompilerInvocation &CI,
284290
IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS) {
291+
std::cerr << PRETTY << "\n";
285292

286293
// Processing similar to PrecompiledPreamble::configurePreamble.
287294

@@ -361,15 +368,18 @@ class SYCLToolchain {
361368
// need this extra `Success` variable to be able to properly return
362369
// compilatoin status.
363370
bool Success = false;
364-
auto RunWithoutPCH = [&]() -> bool {
371+
auto RunWithoutPCH = [&](unsigned LINE = __builtin_LINE()) -> bool {
372+
std::cerr << PRETTY << " " << LINE << "\n";
365373
// Run original invocation:
366374
Success =
367375
Action::runInvocation(std::move(Invocation), Files,
368376
std::move(PCHContainerOps), DiagConsumer);
369377
return Success;
370378
};
371379

372-
auto UseCachedPreamble = [&](StringRef PCHContent) {
380+
auto UseCachedPreamble = [&](StringRef PCHContent,
381+
unsigned LINE = __builtin_LINE()) {
382+
std::cerr << PRETTY << " " << LINE << "\n";
373383
std::unique_ptr<MemoryBuffer> PCHMemBuf =
374384
MemoryBuffer::getMemBufferCopy(PCHContent);
375385

@@ -395,6 +405,8 @@ class SYCLToolchain {
395405

396406
auto CacheCallback = [&](size_t, const Twine &,
397407
std::unique_ptr<MemoryBuffer> MB) -> void {
408+
std::cerr << PRETTY << " " << std::boolalpha << CacheHit
409+
<< "\n";
398410
if (!CacheHit)
399411
return; // See above.
400412

@@ -468,7 +480,11 @@ class SYCLToolchain {
468480

469481
OS << NewPreamble->memoryContents();
470482

471-
consumeError(CFS->commit());
483+
auto Err = CFS->commit();
484+
if (Err) {
485+
std::cerr << "Error in commit\n";
486+
}
487+
consumeError(std::move(Err));
472488

473489
return Success;
474490
} else {

sycl/test-e2e/KernelCompiler/persistent_auto_pch_read_error.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
// RUN: %{run-aux} cp %s %t.dir/*
2020
// RUN: %{run-unfiltered-devices} %t.out
2121

22+
// RUN: %{run-aux} false
23+
// RUN: false
24+
2225
#include <sycl/detail/core.hpp>
2326
#include <sycl/kernel_bundle.hpp>
2427

28+
#include <iostream>
29+
2530
namespace syclexp = sycl::ext::oneapi::experimental;
2631

2732
const std::string src = R"""(
@@ -38,6 +43,7 @@ void foo(int *p) {
3843
)""";
3944

4045
int main() {
46+
std::cout << "PCH_DIR: " PCH_DIR << std::endl;
4147
sycl::queue q;
4248
auto kb_src = syclexp::create_kernel_bundle_from_source(
4349
q.get_context(), syclexp::source_language::sycl, src);

0 commit comments

Comments
 (0)