mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
tint: Implement DP4a on HLSL writer
Bug: tint:1497 Test: tint_unittests Change-Id: I29cc3e56949071230cdbd5afdc59eef076777149 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89706 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
189325ab1f
commit
ab9757036b
@@ -83,6 +83,10 @@ bool IsAtomicBuiltin(BuiltinType i) {
|
||||
i == sem::BuiltinType::kAtomicCompareExchangeWeak;
|
||||
}
|
||||
|
||||
bool IsDP4aBuiltin(BuiltinType i) {
|
||||
return i == sem::BuiltinType::kDot4I8Packed || i == sem::BuiltinType::kDot4U8Packed;
|
||||
}
|
||||
|
||||
Builtin::Builtin(BuiltinType type,
|
||||
const sem::Type* return_type,
|
||||
std::vector<Parameter*> parameters,
|
||||
@@ -135,6 +139,10 @@ bool Builtin::IsAtomic() const {
|
||||
return IsAtomicBuiltin(type_);
|
||||
}
|
||||
|
||||
bool Builtin::IsDP4a() const {
|
||||
return IsDP4aBuiltin(type_);
|
||||
}
|
||||
|
||||
bool Builtin::HasSideEffects() const {
|
||||
if (IsAtomic() && type_ != sem::BuiltinType::kAtomicLoad) {
|
||||
return true;
|
||||
@@ -146,13 +154,10 @@ bool Builtin::HasSideEffects() const {
|
||||
}
|
||||
|
||||
ast::Enable::ExtensionKind Builtin::RequiredExtension() const {
|
||||
switch (type_) {
|
||||
case sem::BuiltinType::kDot4I8Packed:
|
||||
case sem::BuiltinType::kDot4U8Packed:
|
||||
return ast::Enable::ExtensionKind::kChromiumExperimentalDP4a;
|
||||
default:
|
||||
return ast::Enable::ExtensionKind::kNotAnExtension;
|
||||
if (IsDP4a()) {
|
||||
return ast::Enable::ExtensionKind::kChromiumExperimentalDP4a;
|
||||
}
|
||||
return ast::Enable::ExtensionKind::kNotAnExtension;
|
||||
}
|
||||
|
||||
} // namespace tint::sem
|
||||
|
||||
@@ -70,6 +70,11 @@ bool IsBarrierBuiltin(BuiltinType i);
|
||||
/// @returns true if the given `i` is a atomic builtin
|
||||
bool IsAtomicBuiltin(BuiltinType i);
|
||||
|
||||
/// Determins if the given `i` is a DP4a builtin
|
||||
/// @param i the builtin
|
||||
/// @returns true if the given `i` is a DP4a builtin
|
||||
bool IsDP4aBuiltin(BuiltinType i);
|
||||
|
||||
/// Builtin holds the semantic information for a builtin function.
|
||||
class Builtin final : public Castable<Builtin, CallTarget> {
|
||||
public:
|
||||
@@ -130,6 +135,10 @@ class Builtin final : public Castable<Builtin, CallTarget> {
|
||||
/// @returns true if builtin is a atomic builtin
|
||||
bool IsAtomic() const;
|
||||
|
||||
/// @returns true if builtin is a DP4a builtin (defined in the extension
|
||||
/// chromium_experimental_DP4a)
|
||||
bool IsDP4a() const;
|
||||
|
||||
/// @returns true if intrinsic may have side-effects (i.e. writes to at least
|
||||
/// one of its inputs)
|
||||
bool HasSideEffects() const;
|
||||
|
||||
Reference in New Issue
Block a user