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

Fix const-window argument passing #288

Merged
merged 4 commits into from
Nov 12, 2022
Merged

Fix const-window argument passing #288

merged 4 commits into from
Nov 12, 2022

Conversation

alexreinking
Copy link
Contributor

Discovered at the Hackathon yesterday. We don't have enough tests that stress parameter passing, which is why this wasn't caught in the first place...

@@ -66,8 +70,8 @@ struct exo_win_2i8c{
const int8_t * const data;
const int_fast32_t strides[2];
};
struct exo_win_3i8c{
const int8_t * const data;
struct exo_win_3i8{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this test and the others, these structs aren't actually used anywhere. I'm guessing they come from instr signatures, but I'm not totally sure.

Copy link
Member

Choose a reason for hiding this comment

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

Just curious, was there any warning or performance consequence from not having const?

Copy link
Contributor Author

@alexreinking alexreinking Nov 12, 2022

Choose a reason for hiding this comment

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

Nothing we rigorously measured. But there are still a great many reasons for having const.

  1. Having const enables the C compiler to check our generated code. If we misplace a const the C compiler will warn or error, and that means our analysis somewhere is wrong. This helps us catch bugs.
  2. Having accurate const information makes it easier to integrate into existing C codebases. For instance, someone might have a const-qualified buffer in their program. They would have to cast away that const to call an Exo function. That's a recipe for unexpected / undefined behavior.

and so on...

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2022

Codecov Report

Merging #288 (0bf61de) into master (474e55e) will increase coverage by 0.00%.
The diff coverage is 93.54%.

@@           Coverage Diff           @@
##           master     #288   +/-   ##
=======================================
  Coverage   87.91%   87.92%           
=======================================
  Files          72       72           
  Lines       15632    15652   +20     
=======================================
+ Hits        13743    13762   +19     
- Misses       1889     1890    +1     
Impacted Files Coverage Δ
src/exo/LoopIR_compiler.py 94.81% <92.59%> (-0.08%) ⬇️
tests/test_codegen.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@alexreinking alexreinking enabled auto-merge (squash) November 12, 2022 19:21
Copy link
Member

@yamaguchi1024 yamaguchi1024 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@alexreinking alexreinking merged commit d8c6be9 into master Nov 12, 2022
@alexreinking alexreinking deleted the fix-const branch November 12, 2022 19:27
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.

None yet

3 participants