Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and Test with Bazel

on: [push, pull_request]

jobs:
build:
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
- name: Download dependencies
run: python3 utils/git-sync-deps
- name: Mount Bazel cache
uses: actions/cache@v3
with:
path: ~/.bazel/cache
key: bazel-cache-${{ runner.os }}
- name: Build All
run: bazel --output_user_root=~/.bazel/cache build //...
- name: Test All
run: bazel --output_user_root=~/.bazel/cache test //...
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Wasm Build

on: [ push, pull_request ]
on: [push, pull_request]

jobs:
build:
Expand Down
30 changes: 28 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
Revision history for SPIRV-Tools

v2022.5-dev 2022-10-12
- Start v2022.5-dev
v2023.1 2023-01-17
- General
- Renamed "master" to "main" (issue#5051)
- Validate version 5 of clspv reflection (#5050)
- Remove testing support for VS2015 (#5027)
- Fix undef behaviour in hex float parsing (#5025)
- Require C++11 *or later* (#5020)
- Instrument
- Instrument: Fix bindless checking for BufferDeviceAddress (#5049)
- Optimizer
- Optimize allocation of spvtools::opt::Instruction::operands_ (#5024)
- spirv-opt: Fix OpCompositeInsert with Null Constant (#5008)
- spirv-opt: Handle null CompositeInsert (#4998)
- Add option to ADCE to remove output variables from interface. (#4994)
- Add support for tesc, tese and geom to EliminateDead*Components (#4990)
- Add pass to eliminate dead output components (#4982)
- spirv-opt: Add const folding for CompositeInsert (#4943)
- Add passes to eliminate dead output stores (#4970)
- Prevent eliminating case constructs in block merging (#4976)
- Validator
- Fix layout validation (#5015)
- Fix use of invalid analysis (#5013)
- Fix infinite loop in validator (#5006)
- Add validation support for SPV_NV_shader_invocation_reorder. (#4979)
- Only validate full layout in Vulkan environments (#4972)
- spirv-val: Label new Vulkan OpPtrAccessChain VUs (#4975)
- spirv-val: Add OpPtrAccessChain Base checks (#4965)


v2022.4 2022-10-12
- General
Expand Down
13 changes: 3 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@
# limitations under the License.

cmake_minimum_required(VERSION 3.17.2)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
if (POLICY CMP0054)
# Avoid dereferencing variables or interpret keywords that have been
# quoted or bracketed.
# https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
cmake_policy(SET CMP0054 NEW)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(spirv-tools)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

enable_testing()
set(SPIRV_TOOLS "SPIRV-Tools")

Expand Down
6 changes: 3 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use_relative_paths = True
vars = {
'github': 'https://github.com',

'effcee_revision': '35912e1b7778ec2ddcff7e7188177761539e59e0',
'effcee_revision': 'c7b4db79f340f7a9981e8a484f6d5785e24242d1',

# Pin to the last version of googletest that supports C++11.
# Anything later requires C++14
Expand All @@ -12,8 +12,8 @@ vars = {
# Use protobufs before they gained the dependency on abseil
'protobuf_revision': 'v3.13.0.1',

're2_revision': 'd2836d1b1c34c4e330a85a1006201db474bf2c8a',
'spirv_headers_revision': '34d04647d384e0aed037e7a2662a655fc39841bb',
're2_revision': '954656f47fe8fb505d4818da1e128417a79ea500',
'spirv_headers_revision': 'd13b52222c39a7e9a401b44646f0ca3a640fbd47',
}

deps = {
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SPIR-V Tools

NEWS 2023-01-11: Development occurs on the `main` branch.

## Overview

The SPIR-V Tools project provides an API and commands for processing SPIR-V
Expand Down Expand Up @@ -271,7 +273,7 @@ Contributions via merge request are welcome. Changes should:
`clang-format version 5.0.0` for SPIRV-Tools. Settings are defined by
the included [.clang-format](.clang-format) file.

We intend to maintain a linear history on the GitHub `master` branch.
We intend to maintain a linear history on the GitHub `main` branch.

### Getting the source

Expand Down
5 changes: 1 addition & 4 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,7 @@ if (ANDROID)
endif()

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets)
export(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake)

spvtools_config_package_dir(${SPIRV_TOOLS} PACKAGE_DIR)
Expand Down
5 changes: 1 addition & 4 deletions source/diff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ set_property(TARGET SPIRV-Tools-diff PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-diff)

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-diff EXPORT SPIRV-Tools-diffTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SPIRV-Tools-diff EXPORT SPIRV-Tools-diffTargets)
export(EXPORT SPIRV-Tools-diffTargets FILE SPIRV-Tools-diffTargets.cmake)

spvtools_config_package_dir(SPIRV-Tools-diff PACKAGE_DIR)
Expand Down
5 changes: 1 addition & 4 deletions source/fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,7 @@ if(SPIRV_BUILD_FUZZER)
spvtools_check_symbol_exports(SPIRV-Tools-fuzz)

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-fuzz EXPORT SPIRV-Tools-fuzzTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SPIRV-Tools-fuzz EXPORT SPIRV-Tools-fuzzTargets)
export(EXPORT SPIRV-Tools-fuzzTargets FILE SPIRV-Tools-fuzzTarget.cmake)

spvtools_config_package_dir(SPIRV-Tools-fuzz PACKAGE_DIR)
Expand Down
5 changes: 1 addition & 4 deletions source/link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ set_property(TARGET SPIRV-Tools-link PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-link)

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-link EXPORT SPIRV-Tools-linkTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SPIRV-Tools-link EXPORT SPIRV-Tools-linkTargets)
export(EXPORT SPIRV-Tools-linkTargets FILE SPIRV-Tools-linkTargets.cmake)

spvtools_config_package_dir(SPIRV-Tools-link PACKAGE_DIR)
Expand Down
5 changes: 1 addition & 4 deletions source/lint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ set_property(TARGET SPIRV-Tools-lint PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-lint)

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-lint EXPORT SPIRV-Tools-lintTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SPIRV-Tools-lint EXPORT SPIRV-Tools-lintTargets)
export(EXPORT SPIRV-Tools-lintTargets FILE SPIRV-Tools-lintTargets.cmake)

spvtools_config_package_dir(SPIRV-Tools-lint PACKAGE_DIR)
Expand Down
5 changes: 1 addition & 4 deletions source/opt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,7 @@ set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-opt)

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-opt EXPORT SPIRV-Tools-optTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SPIRV-Tools-opt EXPORT SPIRV-Tools-optTargets)
export(EXPORT SPIRV-Tools-optTargets FILE SPIRV-Tools-optTargets.cmake)

spvtools_config_package_dir(SPIRV-Tools-opt PACKAGE_DIR)
Expand Down
30 changes: 18 additions & 12 deletions source/opt/inst_bindless_check_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ void InstBindlessCheckPass::GenCheckCode(
new BasicBlock(std::move(valid_label)));
builder.SetInsertPoint(&*new_blk_ptr);
uint32_t new_ref_id = CloneOriginalReference(ref, &builder);
uint32_t null_id = 0;
uint32_t ref_type_id = ref->ref_inst->type_id();
(void)builder.AddBranch(merge_blk_id);
new_blocks->push_back(std::move(new_blk_ptr));
// Gen invalid block
Expand Down Expand Up @@ -563,10 +565,23 @@ void InstBindlessCheckPass::GenCheckCode(
GenDebugStreamWrite(uid2offset_[ref->ref_inst->unique_id()], stage_idx,
{error_id, u_index_id, u_length_id}, &builder);
}
// Generate a ConstantNull, converting to uint64 if the type cannot be a null.
if (new_ref_id != 0) {
analysis::TypeManager* type_mgr = context()->get_type_mgr();
analysis::Type* ref_type = type_mgr->GetType(ref_type_id);
if (ref_type->AsPointer() != nullptr) {
context()->AddCapability(spv::Capability::Int64);
uint32_t null_u64_id = GetNullId(GetUint64Id());
Instruction* null_ptr_inst = builder.AddUnaryOp(
ref_type_id, spv::Op::OpConvertUToPtr, null_u64_id);
null_id = null_ptr_inst->result_id();
} else {
null_id = GetNullId(ref_type_id);
}
}
// Remember last invalid block id
uint32_t last_invalid_blk_id = new_blk_ptr->GetLabelInst()->result_id();
// Gen zero for invalid reference
uint32_t ref_type_id = ref->ref_inst->type_id();
(void)builder.AddBranch(merge_blk_id);
new_blocks->push_back(std::move(new_blk_ptr));
// Gen merge block
Expand All @@ -577,8 +592,7 @@ void InstBindlessCheckPass::GenCheckCode(
// reference.
if (new_ref_id != 0) {
Instruction* phi_inst = builder.AddPhi(
ref_type_id, {new_ref_id, valid_blk_id, GetNullId(ref_type_id),
last_invalid_blk_id});
ref_type_id, {new_ref_id, valid_blk_id, null_id, last_invalid_blk_id});
context()->ReplaceAllUsesWith(ref->ref_inst->result_id(),
phi_inst->result_id());
}
Expand Down Expand Up @@ -734,15 +748,7 @@ void InstBindlessCheckPass::GenTexBuffCheckCode(
if (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageArrayed) != 0) return;
if (image_ty_inst->GetSingleWordInOperand(kSpvTypeImageMS) != 0) return;
// Enable ImageQuery Capability if not yet enabled
if (!get_feature_mgr()->HasCapability(spv::Capability::ImageQuery)) {
std::unique_ptr<Instruction> cap_image_query_inst(
new Instruction(context(), spv::Op::OpCapability, 0, 0,
std::initializer_list<Operand>{
{SPV_OPERAND_TYPE_CAPABILITY,
{uint32_t(spv::Capability::ImageQuery)}}}));
get_def_use_mgr()->AnalyzeInstDefUse(&*cap_image_query_inst);
context()->AddCapability(std::move(cap_image_query_inst));
}
context()->AddCapability(spv::Capability::ImageQuery);
// Move original block's preceding instructions into first new block
std::unique_ptr<BasicBlock> new_blk_ptr;
MovePreludeCode(ref_inst_itr, ref_block_itr, &new_blk_ptr);
Expand Down
9 changes: 1 addition & 8 deletions source/opt/inst_buff_addr_check_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,7 @@ uint32_t InstBuffAddrCheckPass::GenSearchAndTest(Instruction* ref_inst,
InstructionBuilder* builder,
uint32_t* ref_uptr_id) {
// Enable Int64 if necessary
if (!get_feature_mgr()->HasCapability(spv::Capability::Int64)) {
std::unique_ptr<Instruction> cap_int64_inst(new Instruction(
context(), spv::Op::OpCapability, 0, 0,
std::initializer_list<Operand>{{SPV_OPERAND_TYPE_CAPABILITY,
{uint32_t(spv::Capability::Int64)}}}));
get_def_use_mgr()->AnalyzeInstDefUse(&*cap_int64_inst);
context()->AddCapability(std::move(cap_int64_inst));
}
context()->AddCapability(spv::Capability::Int64);
// Convert reference pointer to uint64
uint32_t ref_ptr_id = ref_inst->GetSingleWordInOperand(0);
Instruction* ref_uptr_inst =
Expand Down
5 changes: 1 addition & 4 deletions source/reduce/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ set_property(TARGET SPIRV-Tools-reduce PROPERTY FOLDER "SPIRV-Tools libraries")
spvtools_check_symbol_exports(SPIRV-Tools-reduce)

if(ENABLE_SPIRV_TOOLS_INSTALL)
install(TARGETS SPIRV-Tools-reduce EXPORT SPIRV-Tools-reduceTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SPIRV-Tools-reduce EXPORT SPIRV-Tools-reduceTargets)
export(EXPORT SPIRV-Tools-reduceTargets FILE SPIRV-Tools-reduceTarget.cmake)

spvtools_config_package_dir(SPIRV-Tools-reduce PACKAGE_DIR)
Expand Down
Loading
Loading