Skip to content

[SYCL] Enhance specialization constants testing.#12647

Merged
aelovikov-intel merged 6 commits intointel:syclfrom
maarquitos14:maronas/spec-constants-enhanced-testing
Feb 23, 2024
Merged

[SYCL] Enhance specialization constants testing.#12647
aelovikov-intel merged 6 commits intointel:syclfrom
maarquitos14:maronas/spec-constants-enhanced-testing

Conversation

@maarquitos14
Copy link
Contributor

Introduce logging ability to SpecConstantsPass through LLVM_DEBUG macro so that we can enhance testing.

Marcos Maronas added 3 commits February 5, 2024 03:56
Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
Copy link
Contributor

@maksimsab maksimsab left a comment

Choose a reason for hiding this comment

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

LGTM

@maarquitos14
Copy link
Contributor Author

Friendly ping @AlexeySachkov

Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

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

Overall, I don't have objections to the approach and I'm fine with merging the PR. However, I still want to record some of my thoughts on the matter:

Testing through debug macro will only help a single pass, but won't provide a generic way of testing properties we emit in a human-readable way. We may also consider adding some mechanisms to tweak how properties are emitted so we can print them in human-readable form for tests. With such infrastructure we would need less changes overall to test that various properties are properly emitted.

At the same time, debug prints within a pass will likely provide better representation for domain-specific info, which we could use to write better tests. This pass is a good example: we print a byte array as a series of triplets, which greatly improves readability of the test.

std::fill_n(std::back_inserter(DefaultValues), NumBytes, 0);
Offset += NumBytes;
// Print tuple {Offset, Size, DefaultValue}.
LLVM_DEBUG(dbgs() << "{" << Offset - NumBytes << ", " << NumBytes << ", "
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have any data about how often folks use LLVM_DEBUG to quickly hack some debugging messages (I personally just use plain llvm::outs() for that), but if we know of someone who does that, then we should probably use DEBUG_WITH_TYPE to allow both generic debug messages and messages which are specific to certain functionality .

With the current approach, if anyone want's to see some printouts from the pass using LLVM_DEBUG mechanism, they may have to filter out this output because it is irrelevant to their investigation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think they could easily do that by defining their own DEBUG_TYPE --it just takes 1 line-- and then pass --debug-only=<custom_type> . Also, I grepped LLVM_DEBUG and there are +11k occurrences, so it's definitely better to filter only their own option if they want to quickly hack some own debugging messages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, DEBUG_WITH_TYPE is handy when you want to have several different filters in a single TU. Otherwise, DEBUG_TYPE is the way to go.

Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
@maarquitos14
Copy link
Contributor Author

The CI failure was already found in #12791, and it's unrelated to this PR. This is ready to merge @intel/llvm-gatekeepers

@aelovikov-intel aelovikov-intel merged commit c9b017c into intel:sycl Feb 23, 2024
@aelovikov-intel
Copy link
Contributor

This breaks post-commit: https://github.com/intel/llvm/actions/runs/8022089783. Please fix asap or revert.

steffenlarsen pushed a commit that referenced this pull request Feb 28, 2024
Recent changes made to specialization constants tests relied on
`--debug-only` option, which is only enabled when assertions are
enabled. This commit guards the commands using such an option to be run
only when assertions are enabled.

This should fix the post-commit CI failure observed after #12647 was
merged.

---------

Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
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.

5 participants