-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL-PTX] Add a JSON backend for the ProgModel builtin #1781
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
Conversation
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.
didn't look particularly close, but comments on the approach.
} | ||
|
||
std::string JSONBuiltinInterfaceEmitter::TypeDesc::GetBaseTypeAsStr() const { | ||
if (Name == "void") { |
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.
Don't use curleys for single line if/else/etc. Applies through this patch.
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.
fixed
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 it? I see some below as well as here still.
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.
done, BTW I can't find where the coding style mention this.
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.
Apparently it is just something that has been enforced forever without having ever been put into the document! I'm likely going to add it to the document to be consistent with what reviewers enforce.
void JSONBuiltinInterfaceEmitter::Emit() { | ||
|
||
// Parse the Records to populate the internal lists. | ||
GetOverloads(); |
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.
I suspect calling these directly is against the original author's abstraction (which is why they were private in the first place). How do other emitters handle this?
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.
There is no other emitter
31fcbc3
to
a2d8392
Compare
// Size of the element in bits. | ||
int Size; | ||
// Is a integer. | ||
bool IsInteger; |
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.
The hope is that it would be more readable as well as more consistent with the rest of clang code.
} | ||
|
||
std::string JSONBuiltinInterfaceEmitter::TypeDesc::GetBaseTypeAsStr() const { | ||
if (Name == "void") { |
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 it? I see some below as well as here still.
|
||
if (Ty->isSubClassOf("GenericType")) { | ||
assert(!Expansion.size() && "Types already expanded"); | ||
auto NVec = Ty->getValueAsDef("VectorList")->getValueAsListOfInts("List"); |
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.
Throughout the patch, you're using 'auto' in cases that the coding standard prohibits.
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.
fixed
a2d8392
to
591043a
Compare
Add a JSON output for the ClangProgModelBuiltinEmitter. This patch also include header generator for libclc that consumes the JSON ouput, which gets automatically trigged on changes on the SPIRVBuiltins.td. Signed-off-by: Victor Lomuller <[email protected]>
… rather than directly in type emission. Signed-off-by: Victor Lomuller <[email protected]>
Signed-off-by: Victor Lomuller <[email protected]>
Signed-off-by: Victor Lomuller <[email protected]>
Signed-off-by: Victor Lomuller <[email protected]>
Signed-off-by: Victor Lomuller <[email protected]>
2851cbc
to
90ba58a
Compare
IsPointer(T->getValueAsBit("IsPointer")), | ||
IsConst(T->getValueAsBit("IsConst")), | ||
IsVolatile(T->getValueAsBit("IsVolatile")) { | ||
assert((!T->getValueAsBit("IsInteger") || !T->getValueAsBit("IsFloat")) && |
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.
Can you please add the isSubClassOf checks as well? It seems that it shouldn't be a BUILTIN either.
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.
It is already handled by the unreachable.
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.
I don't think it is. I'm talking about a type that IsInteger, IsFloat, and isSubClassOf(FundamentalType) AND isSubClassOf(VectorType).
At the moment you catch only isInteger and isFloat, but if you leave any of those off it isnt.
Additionally, the logic below allows a type to be both a fundamental and vector type.
Signed-off-by: Victor Lomuller <[email protected]>
…e a scoped enum in its scope. Signed-off-by: Victor Lomuller <[email protected]>
IsPointer(T->getValueAsBit("IsPointer")), | ||
IsConst(T->getValueAsBit("IsConst")), | ||
IsVolatile(T->getValueAsBit("IsVolatile")) { | ||
assert((!T->getValueAsBit("IsInteger") || !T->getValueAsBit("IsFloat")) && |
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.
I don't think it is. I'm talking about a type that IsInteger, IsFloat, and isSubClassOf(FundamentalType) AND isSubClassOf(VectorType).
At the moment you catch only isInteger and isFloat, but if you leave any of those off it isnt.
Additionally, the logic below allows a type to be both a fundamental and vector type.
}); | ||
assert(SignatureLenIt.begin() != SignatureLenIt.end()); | ||
// Find out how many overloads this signature holds. | ||
size_t NbOverload = 1; |
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.
size_t NbOverload = 1; | |
size_t NbOverload = *std::max_element(std::begin(SignatureLenIt), std::end(SignatureLenIt)); |
std::vector<long int> NVec = | ||
Ty->getValueAsDef("VectorList")->getValueAsListOfInts("List"); |
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.
Sorry for the delay.
Out internal pre-commit check failed to build this patch on Windows with the following message:
clang\utils\TableGen\ClangProgModelBuiltinEmitter.cpp(1026): error C2440: 'initializing': cannot convert from 'std::vector<int64_t,std::allocator<_Ty>>' to 'std::vector<long,std::allocator<_Ty>>'
with
[
_Ty=int64_t
]
and
[
_Ty=long
]
clang\utils\TableGen\ClangProgModelBuiltinEmitter.cpp(1026): note: No constructor could take the source type, or constructor overload resolution was ambiguous
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.
On Windows, "long" is 32 bit, so int64_t is long long. This likely should be std::vector<int64_t> instead.
This add the generator used to create the spirv_builtin.h in #1712
Add a JSON output for the ClangProgModelBuiltinEmitter.
This patch also include header generator for libclc that consumes the JSON ouput,
which gets automatically trigged on changes on the SPIRVBuiltins.td.
Signed-off-by: Victor Lomuller [email protected]