Commit Graph

161 Commits

Author SHA1 Message Date
LU-JOHN
7c778973e5
Allow fmt arg to printf to be an array of i8 in non-constant space (#5677)
* In spirv-val allow format arg to printf to be an array of i8 in Generic space

Signed-off-by: Lu, John <john.lu@intel.com>

* Allow more addr spaces for printf format string

Signed-off-by: Lu, John <john.lu@intel.com>

* Update printf format arg testcase

Signed-off-by: Lu, John <john.lu@intel.com>

* Apply clang-format

Signed-off-by: Lu, John <john.lu@intel.com>

* Reorder code for clarity

Signed-off-by: Lu, John <john.lu@intel.com>

* Only allow other addr spaces if extension is seen

Signed-off-by: Lu, John <john.lu@intel.com>

* Add test to check printf format with extension

Signed-off-by: Lu, John <john.lu@intel.com>

* Add extension correctly

Signed-off-by: Lu, John <john.lu@intel.com>

---------

Signed-off-by: Lu, John <john.lu@intel.com>
2024-07-16 09:20:04 -04:00
David Neto
216574bedb
Allow for empty list of enums for an operand (#5727)
Insert a placeholder enum that is never valid.
This allows compilation to pass on MSVC, which doesn't like
creating an array with explicit type elem[] but which has an empty
initializer.

Bug: crbug.com/351140758
2024-07-04 10:28:38 -04:00
Victor Lomuller
3bc9744d0a
Add FPEncoding operand type. (#5726)
This patch adds the optional FPEncoding operand that can be added to OpTypeFloat.
At the moment there is no usable operand, so support is limited to adding the entry.

Co-authored-by: Kévin Petit <kevin.petit@arm.com>
Co-authored-by: David Neto <dneto@google.com>
2024-07-03 13:18:40 -04:00
Nathan Gauër
6c8b460eb1
misc: remove encoding parameter (#5710)
Those scripts are running on Python2.7 if build with the NDK tools.
Under python2.7, io.open will load as "utf-8" since we give the encoding
option, and return a "unicode" string.
Under Python3, the open() function will return a UTF-8 string.
This means the XMLParser needs to have a different 'encoding' option
depending on the python version.

For some reason I don't know, the XMLParser still fails if we use
'unicode' under Python2.7. But converting the unicode string to utf-8
does work.

Signed-off-by: Nathan Gauër <brioche@google.com>
2024-06-17 16:08:55 +02:00
Steven Perron
ee749f5057
Add abseil to the autoroller (#5680)
The autoroller does not update abseil, and that it stopping us from
updating RE2. This change will update the auto roller, then the next
time it runs, we should be able to update everything.
2024-05-21 22:15:30 -04:00
Zheng Shaokun
e4b1a48aab
Use raw string to avoid unintended escapes in regex (#5676) 2024-05-21 11:34:06 -04:00
Rodrigo Locatti
7c363050de
Add operand types for SPV_NV_raw_access_chains (#5602)
This is needed to unblock builds with updated SPIR-V headers.
It is not a replacement for #5568.
2024-03-06 10:42:22 -05:00
David Neto
14000ad47a
Use python3 explicitly. (#5540)
Some Linux images don't ship with a plain 'python'
2024-01-23 15:42:34 -05:00
ncesario-lunarg
c8510a5e89
Fix python warning seen on Fedora 39 (#5474)
Python 3.12 on Fedora 39 is producing a deprecation warning about
datetime.utcfromtimestamp.

See
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp
for more details.
2023-11-15 10:36:36 -05:00
sethp
d88742fbd8
fix(build): git describe all tagged versions (#5447)
Previously, the version string would include `v2022.4-N-...` indicating N commits since the last annotated tag (`v2022.4`).

This change broadens the search from just annotated tags to all tags that match `v*`, including the latest version `v2023.4.rc2`.

See also: https://github.com/KhronosGroup/SPIRV-Tools/pull/5417#issuecomment-1764772856
2023-11-13 17:28:30 +01:00
Natalie Chouinard
6b1e609ef1
Support missing git in update_build_version.py (#5473)
Return False instead of raising an exception when running git commands
fail, which allows the script to fallback to alternative options.

Fixes #5469
2023-11-10 15:43:11 -08:00
Fumitoshi Ukai
a9c61d1376
update_build_version.py produce deterministic header. (#5426)
When building, .git directory may not exist in current
directory (e.g. chromium build), so it will produce
with current timestamp, which becomes non-deterministic build.

Check if repo_path is in git repository and use git info.
Also fix fallback logic when 'git describe' failed.
'git rev-parse HEAD' result was not used because it didn't
update success.
2023-10-18 18:49:51 +02:00
André Cruz
2d6996f731
Check for git repository before git commands (#5403)
When we are attempting to fetch the version info from the git
repository, first check if we're actually in one, otherwise
spurious errors messages get printed.
2023-09-11 20:52:31 +00:00
Mateusz Przybylski
61221e7d62
Add python3 requirement for the script (#5326)
as python2 may not recgonize utf encoding, per https://bugs.python.org/issue11033
2023-07-18 10:40:43 -04:00
David Neto
e751c7e7db
Treat spir-v.xml as utf-8 (#5306)
* Treat spir-v.xml as utf-8

Treat the input file as utf-8, and configure the XML parser to use
the utf-8 encoding.

The Chromium build was breaking when trying to parse the XML
file as ASCII.

* Use Python io.open

Try to fix the android-ndk-build flow.  It seems to be using
an old Python. For example, Python 2.6 builtin function open()
did not support the 'encoding' keyword argument.  But its io.open
method did support it.
2023-07-07 12:25:26 -04:00
archimedus
04cdb2d344
SPV_KHR_cooperative_matrix (#5286)
* SPV_KHR_cooperative_matrix

* Update DEPS with headers

* Update according to review recommendations

* Bugfix and formatting

* Formatting missed or damaged by VS2022
2023-06-22 18:33:36 -04:00
Steven Perron
3e82fa067d
Revert "Disable RE2 autoroll (#5234)" (#5239)
This reverts commit e357a36ccf.
2023-05-26 10:49:33 -04:00
Steven Perron
e357a36ccf
Disable RE2 autoroll (#5234)
RE2 now depends on Abseil. We need to figure out how to add that
dependency. Disable the autoroll for now.

https://github.com/KhronosGroup/SPIRV-Tools/issues/5233
2023-05-24 16:19:36 +02:00
Steven Perron
9a4e7a1eb5
Update protobuf to v21.12 (#5189)
* Update protobuf to v21.12

We need to update because the current version was not buliding with gcc 12.2. I
could not move upda to v22.x because there was an odd use of some defines that
were causing failures.

* Disable clang warnings for protobuf headers
2023-04-12 19:37:07 +02: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
42267721e1
build: tool to generate a CHANGELOG from tags (#5136)
This small utility parses the CHANGES file to generate
a CHANGELOG that can be used for GitHub releases.

This will be used by the GitHub workflow to make releases
automatic.

Given a CHANGES file path, a tag, the script extract the
editorialized changelog, and writes it to a given output file.
2023-03-08 16:12:41 +01:00
Bruce Dawson
2cf48e9534
Allow invoking git.bat as git on Windows (#5118)
In a Chromium build environment on Windows git is supplied by
depot_tools as git.bat. This was causing build errors on Windows that
are most easily reproduced with this command:

  gn gen out\default && gn clean out\default && ninja -C out\default spirv-as

The errors included:

[12:55:40][ERROR   ] Failed to run "['git', 'tag', '--sort=-v:refname']" in "C:\src\chromium\src\third_party\vulkan-deps\spirv-tools\src": [WinError 2] The system cannot find the file specified
[12:55:40][WARNING ] Could not deduce latest release version from history.

This is because 'git' does not resolve to git.bat unless shell=True is
passed to subprocess.Popen. This change passes shell=True but only on
Windows which resolves these errors.
2023-02-23 03:24:34 +00:00
Nathan Gauër
7823b8ff4a
build: allow update_build to generate fake version (#5098)
When the build is done on a shallow repo, or on a non-git copy,
the version script failed. We should not hard fail, but generate
a "version" (unknown).

Sample outputs:

with git history:
`"v2023.2-dev", "SPIRV-Tools v2023.2-dev v2022.4-87-g53541064"`

with shallow clone:
`"unknown_version", "SPIRV-Tools unknown_version d8759a140bc65811332d5f91f3b08febadd5a21d"`

not a git repo:
`"unknown_version", "SPIRV-Tools unknown_version unknown_hash, 2023-02-02T16:25:48.077995"`
2023-02-03 20:43:03 +00:00
Nathan Gauër
d8759a140b
build: fix bazel build for c++17 (#5097)
This commit changes the way bazel chooses which version to build.
Before, we had a COPT set to -std=c++17, which is analogous to the cmake
way.
However, googletest decided to follow abseil, meaning this is *not*
recommended at all, and causes a mixed-standard build.

From https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#how-to-i-set-the-c-dialect-used-to-build-abseil
we have 3 options to define the standard. Using a bazelrc is what I
believe to be the simplest, as it "fixes" the repo standard.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-02-02 14:05:02 +00:00
Daniel Story
0994ca45b6
Add C interface for Optimizer (#5030) 2023-02-01 13:58:52 +00: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
Nathan Gauër
64ba112ffb
build: refactorize update_build_version (#5079)
This commit prepares the next change to stop parsing the
CHANGES file to determine version, but to use tags instead.
2023-01-27 14:36:09 +00:00
Steven Perron
4683eab649
Create a github action to update DEPS (#5061)
Adding a github action to open a PR when the DEPS can be updated.
It will run once a day or it can be manually triggered.

I updated roll_deps.sh so that it will not return an error if there were no new
commits for a repository.
2023-01-18 13:19:39 -05:00
David Neto
bfd278617c
utils: repos use 'main' as main devlopment branch (#5054)
roll_deps.h: SPIRV-Headers uses 'main'
check_code_format.h: SPIRV-Tools uses 'main'
2023-01-11 15:24:34 -05:00
David Neto
01a3b9bec7
git-sync-deps: Use argparse, and print better help (#5038) 2022-12-21 12:52:28 -05:00
David Neto
6b5a00eb2b
Kokoro CI bots use git-sync-deps to get sources (#5031)
* Kokoro CI bots use git-sync-deps to get sources

Update git-sync-deps to reduce the amount of data downloaded on a first
checkout, while being able to checkout the specific commit specified in
the DEPS file.

Previously the CI bots would only clone --depth=1.  But that's not
enough to check out a specific commit.  So clone either blobless
or treeless.  For a CI bot, treeless is preferable, because it
downloads the least data.  For interactive use, blobless is better
because it prevents redundant downloads of tree data.
See
https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/

Fixes: #5028

* --treeless decays to blob:none when git is too old

* Pin googletest to an older version, to make bazel build work
2022-12-21 10:49:52 -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
Ryan Harrison
98340ec500
Add warning about spurious 'git cl upload' messages (#4800)
Fixes #4186
2022-05-11 15:17:21 -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
Steven Perron
f182d02052
Generalize the copyright check (#4702)
The copyright check has hardcoded the years that can appear in the
copyright check.  This means is has to be constantly updated as new
years or range of years are needed.

We try to  avoid this, at least for a while.  We allow years up to 2027.
The ranges for the years allow any combination of from 2014 to 2027.
2022-02-09 19:21:32 +00:00
luzpaz
65ecfd1093
Fix various source comment (doxygen) typos (#4680)
Found via `codespell -q 3 -L fo,lod,parm
2022-01-26 15:13:08 -05:00
Steven Perron
5003644f55
Fix roll_deps.sh (#4687)
Two deps changes branch names, and roll_deps.sh must be updated.

We also don't want the script to fail just because one of the deps is
already up-to-date.  Set `+e` before rolling the deps.
2022-01-25 15:44:03 -05:00
Jaebaek Seo
fb9a10cd48
spirv-opt: add pass to Spread Volatile semantics (#4667)
Add a pass to spread Volatile semantics to variables with SMIDNV,
WarpIDNV, SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask,
SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask BuiltIn
decorations or OpLoad for them when the shader model is the ray
generation, closest hit, miss, intersection, or callable shaders. This
pass can be used for VUID-StandaloneSpirv-VulkanMemoryModel-04678 and
VUID-StandaloneSpirv-VulkanMemoryModel-04679 (See "Standalone SPIR-V
Validation" section of Vulkan spec "Appendix A: Vulkan Environment for
SPIR-V").

Handle variables used by multiple entry points:

1. Update error check to make it working regardless of the order of
   entry points.
2. For a variable, if it is used by two entry points E1 and E2 and
   it needs the Volatile semantics for E1 while it does not for E2
  - If VulkanMemoryModel capability is enabled, which means we have to
    set memory operation of load instructions for the variable, we
    update load instructions in E1, but do not update the ones in E2.
  - If VulkanMemoryModel capability is disabled, which means we have
    to add Volatile decoration for the variable, we report an error
    because E1 needs to add Volatile decoration for the variable while
    E2 does not.

For the simplicity of the implementation, we assume that all functions
other than entry point functions are inlined.
2022-01-25 13:14:36 -05:00
Pierre Moreau
42dc678913
Remove duplicated "the" from comments (#4666) 2022-01-12 19:04:13 -05:00
Jakub Kuderski
c72c454203
Clarify how to update DEPS (#4626)
-  Mention that `depot_tools` are required and link to that repo.
-  Make `roll_deps.sh` exit on error. The script passes `shellcheck`
   with this change.
-  Reword instruction in the README.
2021-11-09 10:28:01 -05:00
ZHOU He
f9893c4549
spirv-opt: A pass to removed unused input on OpEntryPoint instructions. (#4275)
The new pass will removed interface variable on the OpEntryPoint instruction when they are not statically referenced in the call tree of the entry point.

It can be enabled on the command line using the options `remove-unused-interface-variables`.
2021-06-29 11:33:58 -04:00
Kévin Petit
e065c482c6
Initial support for SPV_KHR_integer_dot_product (#4327)
* Initial support for SPV_KHR_integer_dot_product

- Adds new operand types for packed-vector-format
- Moves ray tracing enums to the end

- PackedVectorFormat is a new optional operand type, so it requires
  special handling in grammar table generation.

- Add SPV_KHR_integer_dot_product to optimizer whitelists.

- Pass-through validation: valid cases pass validation
  Validation errors are not checked.

- Update SPIRV-Headers

Patch by David Neto <dneto@google.com>
Rebase and minor tweaks by Kevin Petit <kevin.petit@arm.com>

Signed-off-by: David Neto <dneto@google.com>
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Change-Id: Icb41741cb7f0f1063e5541ce25e5ba6c02266d2c

* format fixes

Change-Id: I35c82ec27bded3d1b62373fa6daec3ffd91105a3
2021-06-23 13:32:24 -04:00
David Neto
e992c96c89
fix symbol exports check, for Android build cases (#4342)
- Ignore symbols marked as .hidden
- Ignore weakly linked thunks (_ZT prefix)

Without this, the exports check fails on the Android NDK build.
2021-06-23 12:03:34 -04:00
Steven Perron
8ec9f456e6
Fix export symbol test. (#4254)
* Fix export symbol test.

The symbol export test does not check weak symbols, even though they are
possibly exported.  It also does not allow functions in the standard
namespace even though it allows symbols on other namespaces.

I've modified the check to look at the name of weakly defined function,
and I've allowed functions in the standard namespace, functions in a local scope, and
weak definitions of new and delete operators.

Fixes #4250
2021-04-29 14:27:16 -04:00
Ben Clayton
f8c78cc534
Updates to the vscode SPIR-V extension (#4246)
* utils/vscode: Allow running install.sh from any CWD

* utils/vscode: Update schema to latest

* utils/vscode: Don't keep on adding trailing newlines

Repeatedly formatting the file will keep on appending newlines to the end of the file.
Don't do that.
2021-04-29 08:58:55 -04:00
Shiyu Liu
6cdf07d2b3
spirv-fuzz: Swap positions of two functions in a module (#4236)
Adds a new transformation class that swaps the syntactic position of
two functions in the module, and a fuzzer pass to apply it.

Fixes #4026.
2021-04-27 12:33:08 +01:00
Steven Perron
1b8341b8b1
Fix warning in python script. (#4251) 2021-04-26 15:37:38 -04:00
Mostafa Ashraf
8fe39ad581
spirv-fuzz: Permute the order of variables at function scope issue (#4248)
Fixes #4194.
2021-04-26 16:53:55 +01:00
Alastair Donaldson
6578899781
spirv-fuzz: Manage available instructions efficiently (#4177)
Introduces a data structure for efficient management of available
instructions in the fuzzer.
2021-03-20 18:51:18 +00:00
Corentin Wallez
4a59fd4763
Fix -Wextra-semi-stmt -Wsuggest-destructor-override -Wdeprecated-copy-dtor (#4164)
* Fix -Wextra-semi-stmt
* Fix -Wsuggest-destructor-override
* Fix -Wdeprecated-copy-dtor
2021-03-09 13:16:43 +00:00