-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SPV_AMDX_shader_enqueue version 2 support #5838
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// Copyright (c) 2016 Google Inc. | ||
// Modifications Copyright (C) 2024 Advanced Micro Devices, Inc. All rights | ||
// reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
|
@@ -90,6 +92,7 @@ bool Type::IsUniqueType() const { | |
case kStruct: | ||
case kArray: | ||
case kRuntimeArray: | ||
case kNodePayloadArrayAMDX: | ||
return false; | ||
default: | ||
return true; | ||
|
@@ -162,6 +165,7 @@ bool Type::operator==(const Type& other) const { | |
DeclareKindCase(SampledImage); | ||
DeclareKindCase(Array); | ||
DeclareKindCase(RuntimeArray); | ||
DeclareKindCase(NodePayloadArrayAMDX); | ||
DeclareKindCase(Struct); | ||
DeclareKindCase(Opaque); | ||
DeclareKindCase(Pointer); | ||
|
@@ -218,6 +222,7 @@ size_t Type::ComputeHashValue(size_t hash, SeenTypes* seen) const { | |
DeclareKindCase(SampledImage); | ||
DeclareKindCase(Array); | ||
DeclareKindCase(RuntimeArray); | ||
DeclareKindCase(NodePayloadArrayAMDX); | ||
DeclareKindCase(Struct); | ||
DeclareKindCase(Opaque); | ||
DeclareKindCase(Pointer); | ||
|
@@ -485,6 +490,34 @@ void RuntimeArray::ReplaceElementType(const Type* type) { | |
element_type_ = type; | ||
} | ||
|
||
NodePayloadArrayAMDX::NodePayloadArrayAMDX(const Type* type) | ||
: Type(kNodePayloadArrayAMDX), element_type_(type) { | ||
assert(!type->AsVoid()); | ||
} | ||
|
||
bool NodePayloadArrayAMDX::IsSameImpl(const Type* that, | ||
IsSameCache* seen) const { | ||
const NodePayloadArrayAMDX* rat = that->AsNodePayloadArrayAMDX(); | ||
if (!rat) return false; | ||
return element_type_->IsSameImpl(rat->element_type_, seen) && | ||
HasSameDecorations(that); | ||
} | ||
|
||
std::string NodePayloadArrayAMDX::str() const { | ||
std::ostringstream oss; | ||
oss << "[" << element_type_->str() << "]"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With larger sized strings perhaps using string_view (C++17) is better if a basic str concat is not an option. |
||
return oss.str(); | ||
} | ||
|
||
size_t NodePayloadArrayAMDX::ComputeExtraStateHash(size_t hash, | ||
SeenTypes* seen) const { | ||
return element_type_->ComputeHashValue(hash, seen); | ||
} | ||
|
||
void NodePayloadArrayAMDX::ReplaceElementType(const Type* type) { | ||
element_type_ = type; | ||
} | ||
|
||
Struct::Struct(const std::vector<const Type*>& types) | ||
: Type(kStruct), element_types_(types) { | ||
for (const auto* t : types) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// Copyright (c) 2018 Google LLC. | ||
// Modifications Copyright (C) 2024 Advanced Micro Devices, Inc. All rights | ||
// reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
|
@@ -30,6 +32,11 @@ bool DecorationTakesIdParameters(spv::Decoration type) { | |
case spv::Decoration::AlignmentId: | ||
case spv::Decoration::MaxByteOffsetId: | ||
case spv::Decoration::HlslCounterBufferGOOGLE: | ||
case spv::Decoration::NodeMaxPayloadsAMDX: | ||
case spv::Decoration::NodeSharesPayloadLimitsWithAMDX: | ||
case spv::Decoration::PayloadNodeArraySizeAMDX: | ||
case spv::Decoration::PayloadNodeNameAMDX: | ||
case spv::Decoration::PayloadNodeBaseIndexAMDX: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These could all do with a simple test that OpDecoration is disallowed, but OpDecorationId is allowed. |
||
return true; | ||
default: | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason to use a ossringstream object? Given it's a basic routine which might be frequently called I suppose a str concat should be equivalent and more efficient. More so for smaller string values.
If we do have a need to use the ostringstream class obj perhaps consider reusing it by making it part of the class and clear/reset per use.