Skip to content
Open
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
8 changes: 6 additions & 2 deletions source/dcompute/driver/cuda/runtime.d
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ private static bool _threadReady = false; // safety-net flag
// in module-dependency order. No locking needed here.
shared static this()
{
_initPlatform();
if (__dcompute_reflect(ReflectTarget.CUDA,0)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, does this work?
Pretty sure this will always be false for host code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asindarov asindarov Jul 2, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it worked on my mac, I don't have computer with nvidia chip, therefore cannot check the true case

_initPlatform();
}
}

// Per-thread init: thread-local static constructor
// D runtime calls this automatically for every thread (including main) when
// that thread begins. For the main thread it runs after shared static this().
static this()
{
_initThread();
if (__dcompute_reflect(ReflectTarget.CUDA,0)) {
_initThread();
}
}

// Public API
Expand Down
5 changes: 3 additions & 2 deletions source/dcompute/tests/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import std.typecons;
import std.conv : to;
import std.math.traits : isNaN;

import dcompute.driver.cuda.unified_buffer;
import dcompute.tests.dummykernels : saxpy;

version(DComputeTestOpenCL)
import dcompute.driver.ocl;
else version(DComputeTestCUDA)
else version(DComputeTestCUDA) {
import dcompute.driver.cuda.unified_buffer;
import dcompute.driver.cuda;
}
else
static assert(false, "Need to test something!");

Expand Down