Skip to content

Commit 1927fa5

Browse files
committed
Windows fixes
1 parent 4e4c0e4 commit 1927fa5

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎.clang-tidy‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
# modernize-avoid-c-arrays: arrays are passed to and filled by C APIs.
2020
# modernize-return-braced-init-list: `return {};` vs. an explicit type is
2121
# left to the author; it adds noise for the driver-API result structs.
22+
# bugprone-throwing-static-initialization: the handle registries are
23+
# process-lifetime globals whose constructors allocate on some standard
24+
# libraries (MSVC); running out of memory while loading the module is
25+
# fatal either way.
2226
#
2327
# Disabled because they do not match the codebase style:
2428
# performance-enum-size: enum underlying types are left as they are.
2529
# misc-const-correctness: const on every local is not the convention here.
26-
# readability-function-cognitive-complexity: a metric threshold, not a defect;
27-
# it flags only ensure_fn_table, which is flat error handling.
30+
# readability-function-cognitive-complexity: too disruptive.
2831
# readability-identifier-length: short names such as the handle parameter `h`
2932
# are used throughout.
3033
# readability-implicit-bool-conversion: `if (ptr)` and `if (handle)` are the
@@ -38,6 +41,7 @@ Checks: >
3841
bugprone-*,
3942
-bugprone-easily-swappable-parameters,
4043
-bugprone-assignment-in-if-condition,
44+
-bugprone-throwing-static-initialization,
4145
clang-analyzer-*,
4246
misc-*,
4347
-misc-include-cleaner,

‎cuda_core/cuda/core/_cpp/rt/graph.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ struct GraphBox : GraphBoxBase {
8383
GraphAttachmentMap attachments; // Non-owning attachment index.
8484
HandleRegistry<CUgraphNode, GraphNodeHandle> node_handles;
8585

86+
// Not noexcept: the std::map and HandleRegistry members allocate.
8687
GraphBox(
8788
CUgraph resource_, GraphHierarchy *hierarchy_, GraphBox *parent_ = nullptr, CUgraphNode owner_node_ = nullptr
88-
) noexcept
89+
)
8990
: GraphBoxBase{resource_}, hierarchy(hierarchy_), parent(parent_), owner_node(owner_node_)
9091
{
9192
}

‎cuda_core/cuda/core/_cpp/rt/memory.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ deviceptr_import_ipc(const MemoryPoolHandle &h_pool, const void *export_data, co
586586
[&]() noexcept {
587587
return p_cuMemFreeAsync(b->resource, as_cu(stream.h_stream)); // raw: under ipc_import_mutex
588588
},
589-
[&]() noexcept { lock.unlock(); });
589+
[&]() noexcept { lock.release()->unlock(); });
590590
delete b;
591591
}
592592
);
@@ -649,7 +649,7 @@ deviceptr_import_ipc(const MemoryPoolHandle &h_pool, const void *export_data, co
649649
// ============================================================================
650650

651651
FileDescriptorHandle
652-
create_fd_handle(int fd)
652+
create_fd_handle([[maybe_unused]] int fd)
653653
{
654654
#ifdef _WIN32
655655
throw std::runtime_error("create_fd_handle is not supported on Windows");
@@ -669,7 +669,7 @@ create_fd_handle(int fd)
669669
}
670670

671671
FileDescriptorHandle
672-
create_fd_handle_ref(int fd)
672+
create_fd_handle_ref([[maybe_unused]] int fd)
673673
{
674674
#ifdef _WIN32
675675
throw std::runtime_error("create_fd_handle_ref is not supported on Windows");

‎cuda_core/cuda/core/_cpp/rt/py_deferred_cleanup.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ enqueue_cleanup(void *item) noexcept
146146

147147
// Module initialization calls this once with the GIL held, which serializes
148148
// the check, allocation, and publication below.
149+
//
150+
// The queue lives for the rest of the process. MSVC's std::atomic hides the
151+
// publication from the analyzer, which then reports a leak at the closing brace.
152+
// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks)
149153
void
150154
initialize_deferred_cleanup()
151155
{
@@ -155,6 +159,7 @@ initialize_deferred_cleanup()
155159
auto *queue = new DeferredCleanupQueue();
156160
deferred_cleanup_queue.store(queue, std::memory_order_release);
157161
}
162+
// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
158163

159164
void
160165
retry_deferred_cleanup() noexcept

0 commit comments

Comments
 (0)