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
19 changes: 15 additions & 4 deletions mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,21 @@ enum NVVMMemorySpace {
kSharedClusterMemorySpace = 7,
};

/// A pair type of LLVM's Intrinsic ID and args (which are llvm values).
/// This type is returned by the getIntrinsicIDAndArgs() methods.
using IDArgPair =
std::pair<llvm::Intrinsic::ID, llvm::SmallVector<llvm::Value *>>;
/// A struct of LLVM's Intrinsic ID, args (which are llvm values),
/// and args types (which are llvm types).
/// Args types are only required for overloaded intrinsics to provide the
/// correct argument types to the createIntrinsicCall() method.
/// This type is returned by the getIIDAndArgsWithTypes() methods.
struct IIDArgsWithTypes {
IIDArgsWithTypes(llvm::Intrinsic::ID id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need a constructor?

Copy link
Contributor Author

@Wolfram70 Wolfram70 Sep 16, 2025

Choose a reason for hiding this comment

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

This is because when returning this struct with the ternary ? operator, aggregate initialization doesn't work and gives an error, so I added this constructor to explicitly construct the object in those cases instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, can't we use below syntax?

return cond == some_cond ? S1{a1, b1} : S1{a2, b2};

llvm::SmallVector<llvm::Value *> args,
llvm::SmallVector<llvm::Type *> types)
: id(id), args(args), types(types) {}

llvm::Intrinsic::ID id;
llvm::SmallVector<llvm::Value *> args;
llvm::SmallVector<llvm::Type *> types;
};

/// Return the element type and number of elements associated with a wmma matrix
/// of given chracteristics. This matches the logic in IntrinsicsNVVM.td
Expand Down
Loading