Skip to content

Address post-merge review comments on CommandBuffer (#1033)#1086

Open
MarijnS95 wants to merge 3 commits intollvm:mainfrom
Traverse-Research:command-buffer-review-fixes
Open

Address post-merge review comments on CommandBuffer (#1033)#1086
MarijnS95 wants to merge 3 commits intollvm:mainfrom
Traverse-Research:command-buffer-review-fixes

Conversation

@MarijnS95
Copy link
Copy Markdown
Contributor

@MarijnS95 MarijnS95 commented Apr 14, 2026

Address post-review comments from @bogner on #1033. These felt significant enough that they weren't worth cramming into an "unrelated" PR but deserve their own clean follow-up in three individual commits.

  • Add virtual method anchors for all polymorphic types (Buffer, CommandBuffer, Fence, ImageComparatorBase, ImageComparatorDiffImage, Texture) per LLVM coding standards
  • Add file description to header comment
  • Switch to LLVM-style RTTI (classof()) instead of hand-rolled as<T>() + BackendAPI, fixing -Wunused-const-variable

Adding -Werror to the build is left for a separate PR as it requires a warning audit first — the project inherits compile flags from LLVM's CMake infrastructure and backend SDK headers may introduce additional warnings.

Comment on lines +394 to +396
static bool classof(const CommandBuffer *CB) {
return CB->getKind() == GPUAPI::DirectX;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: don't like the name. But I don't really have an alternative. Also, this doesn't seem to be called?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html

A common naming convention is that these enums are “kind”s, to avoid ambiguity with the words “type” or “class” which have overloaded meanings in many contexts within LLVM. Sometimes there will be a natural name for it, like “opcode”. Don’t bikeshed over this; when in doubt use Kind.


Also, this doesn't seem to be called?

Probably for the same reason as #1033 (comment); it'll get used (via the builtin isa<>/dyn_cast<>) when at least Queue::submit() lands, etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's do it this way then!

@manon-traverse manon-traverse requested a review from bogner April 14, 2026 13:07
@MarijnS95
Copy link
Copy Markdown
Contributor Author

MarijnS95 commented Apr 14, 2026

@bogner FYI I asked Claude to find/summarize more classes that lack anchors; these are Fence/Buffer (our new types) and the preexisting ImageComparatorBase/ImageComparatorDiffImage. I'll push an updated commit that fixes all of them shortly.

EDIT: And the new Texture too.

Define destructors out-of-line for Buffer, CommandBuffer, Fence,
ImageComparatorBase, ImageComparatorDiffImage and Texture to avoid
vtable and RTTI emission in every translation unit, per LLVM coding
standards.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MarijnS95 MarijnS95 force-pushed the command-buffer-review-fixes branch from f2eb805 to 278efca Compare April 14, 2026 13:39
MarijnS95 and others added 2 commits April 14, 2026 15:51
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the as<T>() template + BackendAPI static constexpr pattern
with classof() methods enabling llvm::isa/cast/dyn_cast. This also
fixes the -Wunused-const-variable warning on BackendAPI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MarijnS95 MarijnS95 force-pushed the command-buffer-review-fixes branch from 278efca to 19996c7 Compare April 14, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants