Skip to content

[DirectX] Replace ResourceFlag enum with struct fields #106617

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

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

python3kgae
Copy link
Contributor

@python3kgae python3kgae commented Aug 29, 2024

Remove the enum about ResourceFlag.
Add struct ResourceFlags which save the resource flags with bool fields.

This will get better yaml dump.

For #103275

Since we keep the resource flag as uint32_t, the yaml code is unused.
@llvmbot
Copy link
Member

llvmbot commented Aug 29, 2024

@llvm/pr-subscribers-llvm-binary-utilities
@llvm/pr-subscribers-objectyaml

@llvm/pr-subscribers-backend-directx

Author: Xiang Li (python3kgae)

Changes

Since we keep the resource flag as uint32_t, the yaml code is unused.


Full diff: https://github.com/llvm/llvm-project/pull/106617.diff

2 Files Affected:

  • (modified) llvm/include/llvm/ObjectYAML/DXContainerYAML.h (-1)
  • (modified) llvm/lib/ObjectYAML/DXContainerYAML.cpp (-6)
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index e432359b7bbd07..1407f16a3499fc 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -178,7 +178,6 @@ LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ComponentType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::InterpolationMode)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceKind)
-LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::PSV::ResourceFlag)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::D3DSystemValue)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SigComponentType)
 LLVM_YAML_DECLARE_ENUM_TRAITS(llvm::dxbc::SigMinPrecision)
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 21a966d5abd132..b8a0d21c62d6b9 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -266,12 +266,6 @@ void ScalarEnumerationTraits<dxbc::PSV::ResourceKind>::enumeration(
     IO.enumCase(Value, E.Name.str().c_str(), E.Value);
 }
 
-void ScalarEnumerationTraits<dxbc::PSV::ResourceFlag>::enumeration(
-    IO &IO, dxbc::PSV::ResourceFlag &Value) {
-  for (const auto &E : dxbc::PSV::getResourceFlags())
-    IO.enumCase(Value, E.Name.str().c_str(), E.Value);
-}
-
 void ScalarEnumerationTraits<dxbc::D3DSystemValue>::enumeration(
     IO &IO, dxbc::D3DSystemValue &Value) {
   for (const auto &E : dxbc::getD3DSystemValues())

Copy link
Contributor

@damyanp damyanp left a comment

Choose a reason for hiding this comment

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

Is this a follow up to a previous PR? Might be good to have them linked.

@python3kgae
Copy link
Contributor Author

Is this a follow up to a previous PR? Might be good to have them linked.

Done.

@llvm-beanz
Copy link
Collaborator

Have you considered instead handling this the way the SFI0 feature flags are enabled? That allows the YAML to be more expressive.

@python3kgae python3kgae changed the title [NFC][DirectX] Remove ResourceFlag yaml code [DirectX] Replace ResourceFlag enum with struct fields Aug 30, 2024
Copy link

github-actions bot commented Aug 30, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@python3kgae
Copy link
Contributor Author

Have you considered instead handling this the way the SFI0 feature flags are enabled? That allows the YAML to be more expressive.

Updated.

@python3kgae python3kgae merged commit 26f6091 into llvm:main Aug 30, 2024
8 checks passed
@python3kgae python3kgae deleted the rm_resource_flag_yaml branch August 30, 2024 16:52
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 30, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux running on sanitizer-buildbot2 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/3281

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
[379/384] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64.o
[380/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[381/384] Generating Msan-x86_64-with-call-Test
[382/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[383/384] Generating Msan-x86_64-Test
[383/384] Running compiler_rt regression tests
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10229 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
TIMEOUT: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c (10229 of 10229)
******************** TEST 'SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c' FAILED ********************
Exit Code: -9
Timeout: Reached timeout of 900 seconds

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing  -m64 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp && env HWASAN_OPTIONS=die_after_fork=0  /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -m64 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ env HWASAN_OPTIONS=die_after_fork=0 /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: section offset exceeds section size
error: decoding address ranges: invalid range list offset 0x89b5
HWAddressSanitizer:DEADLYSIGNAL
==245217==ERROR: HWAddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x5dc080749bf8 bp 0x00010000002a sp 0x7676741fd138 T245390)
==245217==The signal is caused by a READ memory access.
==245217==Hint: address points to the zero page.
HWAddressSanitizer:DEADLYSIGNAL
==244954==ERROR: HWAddressSanitizer: SEGV on unknown address 0x0000000229e6 (pc 0x5dc080748246 bp 0x767676c84310 sp 0x7676741fd250 T244973)
==244954==The signal is caused by a READ memory access.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
900.06s: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c
156.94s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
153.20s: libFuzzer-x86_64-libcxx-Linux :: out-of-process-fuzz.test
148.53s: libFuzzer-x86_64-static-libcxx-Linux :: out-of-process-fuzz.test
39.76s: libFuzzer-i386-static-libcxx-Linux :: fork_corpus_groups.test
39.49s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
38.45s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
38.31s: libFuzzer-i386-static-libcxx-Linux :: fork.test
38.30s: libFuzzer-i386-default-Linux :: fork.test
38.13s: libFuzzer-i386-libcxx-Linux :: fork.test
37.90s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
37.76s: libFuzzer-x86_64-default-Linux :: fork.test
37.24s: libFuzzer-x86_64-static-libcxx-Linux :: fork_corpus_groups.test
37.15s: libFuzzer-x86_64-libcxx-Linux :: fork.test
Step 9 (test compiler-rt symbolizer) failure: test compiler-rt symbolizer (failure)
...
[379/384] Generating MSAN_INST_GTEST.gtest-all.cc.x86_64.o
[380/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64-with-call.o
[381/384] Generating Msan-x86_64-with-call-Test
[382/384] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
[383/384] Generating Msan-x86_64-Test
[383/384] Running compiler_rt regression tests
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10229 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
TIMEOUT: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c (10229 of 10229)
******************** TEST 'SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c' FAILED ********************
Exit Code: -9
Timeout: Reached timeout of 900 seconds

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing  -m64 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp && env HWASAN_OPTIONS=die_after_fork=0  /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -fsanitize-hwaddress-experimental-aliasing -m64 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
+ env HWASAN_OPTIONS=die_after_fork=0 /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/hwasan-x86_64-Linux/Posix/Output/fork_threaded.c.tmp
error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: section offset exceeds section size
error: decoding address ranges: invalid range list offset 0x89b5
HWAddressSanitizer:DEADLYSIGNAL
==245217==ERROR: HWAddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x5dc080749bf8 bp 0x00010000002a sp 0x7676741fd138 T245390)
==245217==The signal is caused by a READ memory access.
==245217==Hint: address points to the zero page.
HWAddressSanitizer:DEADLYSIGNAL
==244954==ERROR: HWAddressSanitizer: SEGV on unknown address 0x0000000229e6 (pc 0x5dc080748246 bp 0x767676c84310 sp 0x7676741fd250 T244973)
==244954==The signal is caused by a READ memory access.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Slowest Tests:
--------------------------------------------------------------------------
900.06s: SanitizerCommon-hwasan-x86_64-Linux :: Posix/fork_threaded.c
156.94s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
153.20s: libFuzzer-x86_64-libcxx-Linux :: out-of-process-fuzz.test
148.53s: libFuzzer-x86_64-static-libcxx-Linux :: out-of-process-fuzz.test
39.76s: libFuzzer-i386-static-libcxx-Linux :: fork_corpus_groups.test
39.49s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
38.45s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
38.31s: libFuzzer-i386-static-libcxx-Linux :: fork.test
38.30s: libFuzzer-i386-default-Linux :: fork.test
38.13s: libFuzzer-i386-libcxx-Linux :: fork.test
37.90s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
37.76s: libFuzzer-x86_64-default-Linux :: fork.test
37.24s: libFuzzer-x86_64-static-libcxx-Linux :: fork_corpus_groups.test
37.15s: libFuzzer-x86_64-libcxx-Linux :: fork.test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants