Skip to content

Commit 0461c00

Browse files
committed
[Fixup] clang-tidy: rename MetalCommandList::flush_pending_encoder_ to drop trailing underscore + add override on KernelLauncher destructors
1 parent 8272f07 commit 0461c00

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

quadrants/rhi/metal/metal_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class MetalCommandList final : public CommandList {
422422
// Silicon's M-series GPUs costs ~700 us of inter-dispatch gap (encoder teardown plus re-bind state), and Metal's
423423
// `dispatchType=Serial` already gives the same per-dispatch ordering inside a single encoder, so coalescing into one
424424
// encoder is semantics-preserving and shaves the gap to driver-scheduling overhead. The encoder is opened lazily on
425-
// the first `dispatch()` call and torn down via `flush_pending_encoder_` before any encoder-incompatible op
425+
// the first `dispatch()` call and torn down via `flush_pending_encoder` before any encoder-incompatible op
426426
// (`buffer_copy`, `buffer_fill`, `begin_renderpass`) and before `finalize()` returns the cmdbuf to the stream for
427427
// commit. Set of physical buffers already passed through `useResource:` in this encoder lifetime is tracked alongside
428428
// so we don't issue redundant `useResource:` calls inside one encoder. Initialised to `nullptr` (the C++ form of
@@ -431,7 +431,7 @@ class MetalCommandList final : public CommandList {
431431
// `nullptr` is a valid initialiser for both.
432432
MTLComputeCommandEncoder_id current_compute_encoder_{nullptr};
433433
std::unordered_set<uint64_t> compute_encoder_resident_alloc_ids_;
434-
void flush_pending_encoder_();
434+
void flush_pending_encoder();
435435
};
436436

437437
class MetalStream final : public Stream {

quadrants/rhi/metal/metal_device.mm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@
413413
}
414414

415415
MetalCommandList::~MetalCommandList() {
416-
flush_pending_encoder_();
416+
flush_pending_encoder();
417417
[cmdbuf_ release];
418418
}
419419

@@ -422,7 +422,7 @@
422422
// returned for commit, so a long chain of `dispatch()` calls collapses to a
423423
// single MTLComputeCommandEncoder while incompatible ops still observe the
424424
// right per-encoder boundary that Metal's hazard tracking relies on.
425-
void MetalCommandList::flush_pending_encoder_() {
425+
void MetalCommandList::flush_pending_encoder() {
426426
if (current_compute_encoder_ != nil) {
427427
[current_compute_encoder_ endEncoding];
428428
[current_compute_encoder_ release];
@@ -487,7 +487,7 @@
487487

488488
void MetalCommandList::buffer_copy(DevicePtr dst, DevicePtr src,
489489
size_t size) noexcept {
490-
flush_pending_encoder_();
490+
flush_pending_encoder();
491491
const MetalMemory &src_memory = device_->get_memory(src.alloc_id);
492492
const MetalMemory &dst_memory = device_->get_memory(dst.alloc_id);
493493

@@ -515,7 +515,7 @@
515515
void MetalCommandList::buffer_fill(DevicePtr ptr, size_t size,
516516
uint32_t data) noexcept {
517517
RHI_ASSERT(data == 0);
518-
flush_pending_encoder_();
518+
flush_pending_encoder();
519519

520520
const MetalMemory &memory = device_->get_memory(ptr.alloc_id);
521521

@@ -555,15 +555,15 @@
555555
// so per-dispatch ordering inside one encoder is the same as separate
556556
// encoders, but we save the ~700 us of encoder-end / encoder-begin gap that
557557
// the Metal System Trace surfaces between every quadrants dispatch. The
558-
// encoder is torn down by `flush_pending_encoder_` whenever an
558+
// encoder is torn down by `flush_pending_encoder` whenever an
559559
// encoder-incompatible op (blit / render / cmdbuf finalize) needs to start.
560560
if (current_compute_encoder_ == nullptr) {
561561
// `[cmdbuf_ computeCommandEncoder]` returns an autoreleased encoder.
562562
// Retain it so the encoder survives past the enclosing `@autoreleasepool`
563563
// drain into the next `dispatch()` call; without this the autoreleased
564564
// encoder is freed before we end it, and Metal's
565565
// `_MTLCommandEncoder dealloc` asserts "Command encoder released without
566-
// endEncoding". Released by `flush_pending_encoder_` after `endEncoding`.
566+
// endEncoding". Released by `flush_pending_encoder` after `endEncoding`.
567567
current_compute_encoder_ = [[cmdbuf_ computeCommandEncoder] retain];
568568
}
569569
MTLComputeCommandEncoder_id encoder = current_compute_encoder_;
@@ -621,7 +621,7 @@
621621
std::vector<float> *clear_colors,
622622
DeviceAllocation *depth_attachment,
623623
bool depth_clear) {
624-
flush_pending_encoder_();
624+
flush_pending_encoder();
625625
current_renderpass_details_.clear_depth = depth_clear;
626626

627627
int rendertarget_height = 0;
@@ -771,7 +771,7 @@
771771
void MetalCommandList::set_renderpass_active() { is_renderpass_active_ = true; }
772772

773773
MTLRenderCommandEncoder_id MetalCommandList::pre_draw_setup() {
774-
flush_pending_encoder_();
774+
flush_pending_encoder();
775775
const RasterParams *raster_params = current_pipeline_->raster_params();
776776

777777
MTLRenderPassDescriptor *rpd = create_render_pass_desc(
@@ -983,7 +983,7 @@
983983
buffer_image_copy_params_to_mtl(params, src_buf.offset,
984984
dst_image.mtl_texture(), &mtl_params);
985985

986-
flush_pending_encoder_();
986+
flush_pending_encoder();
987987
@autoreleasepool {
988988
MTLBlitCommandEncoder_id encoder = [cmdbuf_ blitCommandEncoder];
989989
[encoder copyFromBuffer:src_buffer.mtl_buffer()
@@ -1011,7 +1011,7 @@
10111011
buffer_image_copy_params_to_mtl(params, dst_buf.offset,
10121012
src_image.mtl_texture(), &mtl_params);
10131013

1014-
flush_pending_encoder_();
1014+
flush_pending_encoder();
10151015
@autoreleasepool {
10161016
MTLBlitCommandEncoder_id encoder = [cmdbuf_ blitCommandEncoder];
10171017
[encoder copyFromTexture:src_image.mtl_texture()
@@ -1036,7 +1036,7 @@
10361036
const MetalImage &src_image = device_->get_image(src_img.alloc_id);
10371037
const MetalImage &dst_image = device_->get_image(dst_img.alloc_id);
10381038

1039-
flush_pending_encoder_();
1039+
flush_pending_encoder();
10401040
@autoreleasepool {
10411041
MTLBlitCommandEncoder_id encoder = [cmdbuf_ blitCommandEncoder];
10421042
[encoder
@@ -1062,7 +1062,7 @@
10621062
}
10631063

10641064
MTLCommandBuffer_id MetalCommandList::finalize() {
1065-
flush_pending_encoder_();
1065+
flush_pending_encoder();
10661066
return cmdbuf_;
10671067
}
10681068

quadrants/runtime/amdgpu/kernel_launcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class KernelLauncher : public LLVM::KernelLauncher {
5252
std::vector<Context> contexts_;
5353

5454
public:
55-
~KernelLauncher();
55+
~KernelLauncher() override;
5656
};
5757

5858
} // namespace amdgpu

quadrants/runtime/cuda/kernel_launcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class KernelLauncher : public LLVM::KernelLauncher {
6565
std::size_t persistent_result_buffer_capacity_{0};
6666

6767
public:
68-
~KernelLauncher();
68+
~KernelLauncher() override;
6969
};
7070

7171
} // namespace cuda

0 commit comments

Comments
 (0)