Commit Graph

22 Commits

Author SHA1 Message Date
John Cater
54691dcd73
Migrate exec_tools back to tools. (#5280)
The host transition migration is done so these can now be moved back and
`exec_tools` can be removed.
2023-06-21 15:32:27 -04:00
Nathan Gauër
5f4e694e10
Implement source extraction logic for spirv-objdump (#5150)
* dump: add ability to extract HLSL from module

Only adds the code to extract the source from the module. The extracted files are written to the given directory.
Android NDK21 has C++17 support, but no std::filesystem support. (NDK22). As for now, the tool is not built on Android.
Might be something to revisit is the need to have this tool on Android arises.
2023-03-22 23:57:18 +01:00
Nathan Gauër
fcd53c8ed2
Add spirv-dump tool (#5146)
* dump: add tool skeleton.

This tool aims to be used a bit like objdump (hence the name).
Allowing the user to dump some info from a spirv-binary.

* add test structure for spirv-dump

* add spirv-dump to bazel build file

* fix licenses

* fix compilation with ubsan

* remove fdiagnostics

* rename dump to objdump

* move tests to test/tools

* rename dump to objdump for bazel
2023-03-13 16:39:42 +01:00
Nathan Gauër
b029037aaa
Revert changes around CHANGES file. (#5143)
* Revert "build: allow update_build to generate fake version (#5098)"

This reverts commit 7823b8ff4a.

* Revert "build: stop parsing CHANGES file. (#5067)"

This reverts commit fcfc3c580c.
2023-03-09 18:24:20 +01:00
Nathan Gauër
2e0f4b52c9
tools: refactorize tools flags parsing. (#5111)
* tools: refactorize tools flags parsing.

Each SPIR-V tool was handing their own flag parsing. This PR
adds a new flag parsing utility that should be flexible enough
for our usage, but generic enough so it can be shared across tools while
remaining simple to use.

* cfg: replace cfg option parsing with the new one.

* change spirv-dis parsing + title + summary

* clang format

* flags: fix static init fiasco & remove help

Static initialization order is important, and was
working just by sheer luck.

Also removing the help generation tooling. It's less flexible than the
hand-written string, and making it as-good and as-flexible brings too
much complexity.

* review feedback
2023-02-27 18:45:14 +01:00
Kevin Lubick
dfcbf310af
Change exec_tools -> tools for local genrule (#5104) 2023-02-08 09:20:47 -05:00
Nathan Gauër
fcfc3c580c
build: stop parsing CHANGES file. (#5067)
The CHANGES file was an alternative source of truth that was trying
to duplicate/replace the git history truth.
This allow us to change the way we handle releases so we don't have to make
sure our CHANGES PR are linked to the tag and tested PR, simplifying the
process.
2023-01-30 13:23:41 -05:00
Rafael Marinheiro
c5d2316430
Enforce layering_check in Bazel build rules. (#5032)
* Enforce layering_check in Bazel build rules.

Enforcing layering_check ensures that the Build targets do not rely on
transitive dependencies. See
https://github.com/bazelbuild/bazel/pull/11440 for a detailed
description of the feature.

We also do a style pass on the build files, ensuring that common linters
are happy with it.

* Add .bazelversion file and fix build_defs.bzl.

We fix build_defs.bzl to work on Bazel 5.0.0.
2022-12-20 10:54:46 -05:00
alan-baker
d35a78db57
Switch SPIRV-Tools to use spirv.hpp11 internally (#4981)
Fixes #4960

* Switches to using enum classes with an underlying type to avoid
  undefined behaviour
2022-11-04 17:27:10 -04:00
Kevin Lubick
6803cc5126
use exec_tools instead of tools for better RBE compatibility (#4837) 2022-07-05 13:54:59 -04:00
Natalie Chouinard
78a0f075ac
Fix gen_build_version on Windows (#4780)
* Fix gen_build_version on Windows

The paths used in the gen_build_version script are causing some failures
in downstream builds. Switch to using the location of the CHANGES file
rather than the ".." parent directory workaround.

* Update other build files
2022-04-07 13:19:05 +00:00
IcyTv
98dce6ca18
Fixed Bazel Windows build (#4736)
* Fixed Bazel Windows build

Before this commit, the bazel build setup would not work on windows.
This is due to the fact, that genrule tries to use bash, which fails.
One fix would be to use bazel-skylib's run_binary.
This however does not work (easily) since genrules is more complex.

To (temporarily) fix the windows build, I added the `cmd_bat` property to every genrule.
This seems more like a hack, because it basically repeat commands,
 but for now it at least builds on windows.

* Removed BAZEL_SH from bazel presubmit build script

Thanks to @s-perron for pointing out, that the presubmit script uses the msys64 bash shell for the bazel build.
Since adding the `cmd_bat` argument removes the dependency on bash, this is no longer needed.
2022-03-07 12:50:19 -05:00
Greg Fischer
1454c95d1b
spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493)
Includes:
- Shift to use of spirv-header extinst.nonsemantic.shader grammar.json
- Remove extinst.nonsemantic.vulkan.debuginfo.100.grammar.json
- Enable all optimizations for Shader.DebugInfo

Also fixes scalar replacement to only insert DebugValue after all
OpVariables. This is not necessary for OpenCL.DebugInfo, but it is
for Shader.DebugInfo.

Likewise, fixes Private-to-Local to insert DebugDeclare after all
OpVariables.

Also fixes inlining to handle FunctionDefinition which can show up
after first block if early return processing happens.

Co-authored-by: baldurk <baldurk@baldurk.org>
2021-09-15 14:38:53 -04:00
dong-ja
937227c761
Add divergence analysis to linter (#4465)
Currently, handles promotion of divergence due to reconvergence rules, but doesn't handle "late merges" caused by a later-than-necessary declared merge block.

Co-authored-by: Jakub Kuderski <kubak@google.com>
2021-08-23 17:03:28 -04:00
dong-ja
1ad8b71359
spirv-lint: add basic CLI argument handling (#4478)
Mostly copied from spirv-opt. Simply reads in a single input file.
2021-08-18 16:17:03 -04:00
dong-ja
706dc27a62
Add new target for spirv-lint (#4446)
This PR adds a new executable spirv-lint with a simple "Hello, world!"
program, along with its associated library and a dummy unit test.

For now, only adds to CMake and Bazel; other build systems will be added
in a future PR.

Issue: #3196
2021-08-06 14:03:59 -04:00
Greg Fischer
8966cc2b27
Add common enum for debug info instructions from either opencl or vulkan (#4377)
Co-authored-by: baldurk <baldurk@baldurk.org>
2021-07-16 16:28:14 -04:00
Greg Fischer
3b6abf41cc
Add non-semantic vulkan extended instruction set (#4362)
This is based on a legacy commit which installs a local grammar. A
followup commit will change to the grammar in SPIRV-Headers.

Co-authored-by: baldurk <baldurk@baldurk.org>
2021-07-12 05:51:08 -04:00
alan-baker
50300450af
Validator support for non-semantic clspv reflection (#3618)
* Generate ext inst table for reflection
* Change build to use grammar files from SPIRV-Headers instead of
  SPIRV-Tools
* Add enum for clspv reflection extended instruction set
  * count it as non-semantic
* validate clspv reflection extended instruction set
* Remove local extended inst sets
* update headers deps
* Update nbuilds to use grammars from SPIRV-Headers instead of
  local duplicates
2020-07-30 12:08:53 -04:00
David Neto
64f36ea529
Support OpenCL.DebugInfo.100 extended instruction set (#3080)
* Clone opencl.debuginfo.100 grammar from debuginfo grammar

Update version number to 200 revision 2

* Apply content from OpenCL.DebugInfo.100 extension text

* Rename grammar file

* Support OpenCL.DebugInfo.100 extended instructions

Add support for prefixing operand type names, to disambiguate
them between different instruction sets.

* Add tests for OpenCL.DebugInfo.100

* Support lookup of OpenCL.DebugInfo.100 extinst

* Add tests for enum values

* Recognize 2017-2019 as copyright date range

* Android.mk: support OpenCL.DebugInfo.100 extended instruction set

Also, stop generating core instruction tables for non-unified1 versions
of the grammar.

* Imported entity operand type is concrete

* Bazel: Suppoort OpenCL.DebugInfo.100

* BUILD.gn: Support OpenCL.DebugInfo.100
2019-12-19 17:16:26 -05:00
Ehsan
82f84c4b8f
Use a longer timeout for Bazel tests. (#2956) 2019-10-09 15:14:42 -05:00
Ehsan
a03cd1f3eb
Add Bazel build configuration. (#2891)
* Add Bazel build configuration.

* fix for windows.

* Update doc file.

* Add tests that were accidentally skipped by Bazel

* Update doc file.
2019-09-24 15:56:59 -04:00