Skip to content
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

EmitC: Allow arrays of size zero #255

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

mgehre-amd
Copy link
Collaborator

This is allowed as a GCC extension, see https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html.

It's helpful when coming from tensors with zero size dimensions to make the lowering code more uniform.

This is allowed as a GCC extension, see https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
and helps to make the lowering code more uniform.
@mgehre-amd mgehre-amd requested a review from cferry-AMD August 13, 2024 11:32
Copy link
Collaborator

@cferry-AMD cferry-AMD left a comment

Choose a reason for hiding this comment

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

This deviates from C99:

In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
an expression or *. If they delimit an expression (which specifies the size of an array), the
expression shall have an integer type. If the expression is a constant expression, it shall
have a value greater than zero
.

Should we mention that in mlir/docs/Dialects/emitc.md?

@mgehre-amd mgehre-amd enabled auto-merge August 13, 2024 11:57
@mgehre-amd
Copy link
Collaborator Author

This deviates from C99:

In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
an expression or *. If they delimit an expression (which specifies the size of an array), the
expression shall have an integer type. If the expression is a constant expression, it shall
have a value greater than zero
.

Should we mention that in mlir/docs/Dialects/emitc.md?

Done!

@mgehre-amd mgehre-amd merged commit dca5fca into feature/fused-ops Aug 13, 2024
3 checks passed
@mgehre-amd mgehre-amd deleted the matthias.emitc_array_zero branch August 13, 2024 12:59
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.

2 participants