Skip to content

Commit

Permalink
Merge pull request #10 from jkwak-work/merge/update
Browse files Browse the repository at this point in the history
Merge/update
  • Loading branch information
jkwak-work authored Oct 18, 2024
2 parents db36df6 + ba37b3b commit c4fb839
Show file tree
Hide file tree
Showing 57 changed files with 1,380 additions and 2,318 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autoroll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

# Checkout the depot tools they are needed by roll_deps.sh
- name: Checkout depot tools
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: '0'
- name: Download dependencies
run: python3 utils/git-sync-deps
- name: Mount Bazel cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: ~/.bazel/cache
key: bazel-cache-${{ runner.os }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-12, macos-13 ]
os: [ macos-latest ]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: lukka/get-cmake@070a0507a7abe157ef918deec391da1be197d2d1 # v3.30.3
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: lukka/get-cmake@b516803a3c5fac40e2e922349d15cdebdba01e60 # v3.30.5
- name: Download dependencies
run: python3 utils/git-sync-deps
# NOTE: The MacOS SDK ships universal binaries. CI should reflect this.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
prepare-release-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Prepare CHANGELOG for version
run: |
python utils/generate_changelog.py CHANGES "${{ github.ref_name }}" VERSION_CHANGELOG
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false

Expand All @@ -40,14 +40,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: '0'
- name: Build web
Expand Down
2 changes: 0 additions & 2 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ SPVTOOLS_OPT_SRC_FILES := \
source/opt/inline_pass.cpp \
source/opt/inline_exhaustive_pass.cpp \
source/opt/inline_opaque_pass.cpp \
source/opt/inst_debug_printf_pass.cpp \
source/opt/instruction.cpp \
source/opt/instruction_list.cpp \
source/opt/instrument_pass.cpp \
source/opt/interface_var_sroa.cpp \
source/opt/interp_fixup_pass.cpp \
source/opt/invocation_interlock_placement_pass.cpp \
Expand Down
2 changes: 0 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ cc_library(
cc_library(
name = "spirv_tools_opt",
hdrs = [
"include/spirv-tools/instrument.hpp",
"include/spirv-tools/optimizer.hpp",
],
copts = COMMON_COPTS,
Expand All @@ -196,7 +195,6 @@ cc_library(
":gen_vendor_tables_spv_amd_shader_ballot",
],
hdrs = glob(["source/opt/*.h"]) + [
"include/spirv-tools/instrument.hpp",
"include/spirv-tools/optimizer.hpp",
],
copts = COMMON_COPTS,
Expand Down
5 changes: 0 additions & 5 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ config("spvtools_internal_config") {

source_set("spvtools_headers") {
sources = [
"include/spirv-tools/instrument.hpp",
"include/spirv-tools/libspirv.h",
"include/spirv-tools/libspirv.hpp",
"include/spirv-tools/linker.hpp",
Expand Down Expand Up @@ -683,14 +682,10 @@ static_library("spvtools_opt") {
"source/opt/inline_opaque_pass.h",
"source/opt/inline_pass.cpp",
"source/opt/inline_pass.h",
"source/opt/inst_debug_printf_pass.cpp",
"source/opt/inst_debug_printf_pass.h",
"source/opt/instruction.cpp",
"source/opt/instruction.h",
"source/opt/instruction_list.cpp",
"source/opt/instruction_list.h",
"source/opt/instrument_pass.cpp",
"source/opt/instrument_pass.h",
"source/opt/interface_var_sroa.cpp",
"source/opt/interface_var_sroa.h",
"source/opt/interp_fixup_pass.cpp",
Expand Down
14 changes: 14 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
Revision history for SPIRV-Tools

v2024.4 2024-09-19
- General
- Add FPEncoding operand type. (#5726)
- Support SPV_KHR_untyped_pointers (#5736)
- add support for SPV_INTEL_global_variable_host_access (#5786)
- Optimizer
- Add knowledge of cooperative matrices (#5720)
- Add struct-packing pass and unit test. (#5778)
- Validator
- Validate presence of Stride operand to OpCooperativeMatrix{Load,Store}KHR (#5777)
- Update sampled image validation (#5789)
- Linker
- allow linking functions with different pointer arguments (#5534)

v2024.3 2024-06-20
- General
- Optimizer
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ if(ENABLE_SPIRV_TOOLS_INSTALL)
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/optimizer.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/linker.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/instrument.hpp
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/spirv-tools/)
endif(ENABLE_SPIRV_TOOLS_INSTALL)
Expand Down
6 changes: 3 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ use_relative_paths = True
vars = {
'github': 'https://github.com',

'abseil_revision': 'f7c22f52a748761b93c50a27b06afef000b26f95',
'abseil_revision': '40cab244558f225cadcb943f84c5209f7ce876b1',

'effcee_revision': '2c97e5689ed8d7ab6ae5820f884f03a601ae124b',

'googletest_revision': '0953a17a4281fc26831da647ad3fcd5e21e6473b',
'googletest_revision': '71815bbf7de6e10c11821d654a2fae2cf42de0f7',

# Use protobufs before they gained the dependency on abseil
'protobuf_revision': 'v21.12',

're2_revision': '6dcd83d60f7944926bfd308cc13979fc53dd69ca',

'spirv_headers_revision': '2a9b6f951c7d6b04b6c21fe1bf3f475b68b84801',
'spirv_headers_revision': '50bc4debdc3eec5045edbeb8ce164090e29b91f3',
}

deps = {
Expand Down
79 changes: 0 additions & 79 deletions include/spirv-tools/instrument.hpp

This file was deleted.

12 changes: 0 additions & 12 deletions include/spirv-tools/optimizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,18 +747,6 @@ Optimizer::PassToken CreateReduceLoadSizePass(
// them into a single instruction where possible.
Optimizer::PassToken CreateCombineAccessChainsPass();

// Create a pass to instrument OpDebugPrintf instructions.
// This pass replaces all OpDebugPrintf instructions with instructions to write
// a record containing the string id and the all specified values into a special
// printf output buffer (if space allows). This pass is designed to support
// the printf validation in the Vulkan validation layers.
//
// The instrumentation will write buffers in debug descriptor set |desc_set|.
// It will write |shader_id| in each output record to identify the shader
// module which generated the record.
Optimizer::PassToken CreateInstDebugPrintfPass(uint32_t desc_set,
uint32_t shader_id);

// Create a pass to upgrade to the VulkanKHR memory model.
// This pass upgrades the Logical GLSL450 memory model to Logical VulkanKHR.
// Additionally, it modifies memory, image, atomic and barrier operations to
Expand Down
1 change: 1 addition & 0 deletions source/binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ spv_result_t Parser::parseOperand(size_t inst_offset,
case SPV_OPERAND_TYPE_OPTIONAL_PACKED_VECTOR_FORMAT:
case SPV_OPERAND_TYPE_FPENCODING:
case SPV_OPERAND_TYPE_OPTIONAL_FPENCODING:
case SPV_OPERAND_TYPE_HOST_ACCESS_QUALIFIER:
case SPV_OPERAND_TYPE_LOAD_CACHE_CONTROL:
case SPV_OPERAND_TYPE_STORE_CACHE_CONTROL:
case SPV_OPERAND_TYPE_NAMED_MAXIMUM_NUMBER_OF_REGISTERS: {
Expand Down
42 changes: 32 additions & 10 deletions source/opcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,42 @@ spv_result_t spvOpcodeTableNameLookup(spv_target_env env,
const auto version = spvVersionForTargetEnv(env);
for (uint64_t opcodeIndex = 0; opcodeIndex < table->count; ++opcodeIndex) {
const spv_opcode_desc_t& entry = table->entries[opcodeIndex];
// We considers the current opcode as available as long as
// We consider the current opcode as available as long as
// 1. The target environment satisfies the minimal requirement of the
// opcode; or
// 2. There is at least one extension enabling this opcode.
//
// Note that the second rule assumes the extension enabling this instruction
// is indeed requested in the SPIR-V code; checking that should be
// validator's work.
if (((version >= entry.minVersion && version <= entry.lastVersion) ||
entry.numExtensions > 0u || entry.numCapabilities > 0u) &&
nameLength == strlen(entry.name) &&
!strncmp(name, entry.name, nameLength)) {
// NOTE: Found out Opcode!
*pEntry = &entry;
return SPV_SUCCESS;
if ((version >= entry.minVersion && version <= entry.lastVersion) ||
entry.numExtensions > 0u || entry.numCapabilities > 0u) {
// Exact match case.
if (nameLength == strlen(entry.name) &&
!strncmp(name, entry.name, nameLength)) {
*pEntry = &entry;
return SPV_SUCCESS;
}
// Lack of binary search really hurts here. There isn't an easy filter to
// apply before checking aliases since we need to handle promotion from
// vendor to KHR/EXT and KHR/EXT to core. It would require a sure-fire way
// of dropping suffices. Fortunately, most lookup are based on token
// value.
//
// If this was a binary search we could iterate between the lower and
// upper bounds.
if (entry.numAliases > 0) {
for (uint32_t aliasIndex = 0; aliasIndex < entry.numAliases;
aliasIndex++) {
// Skip Op prefix. Should this be encoded in the table instead?
const auto alias = entry.aliases[aliasIndex] + 2;
const size_t aliasLength = strlen(alias);
if (nameLength == aliasLength && !strncmp(name, alias, nameLength)) {
*pEntry = &entry;
return SPV_SUCCESS;
}
}
}
}
}

Expand All @@ -133,8 +154,8 @@ spv_result_t spvOpcodeTableValueLookup(spv_target_env env,
const auto beg = table->entries;
const auto end = table->entries + table->count;

spv_opcode_desc_t needle = {"", opcode, 0, nullptr, 0, {},
false, false, 0, nullptr, ~0u, ~0u};
spv_opcode_desc_t needle = {"", opcode, 0, nullptr, 0, {}, 0,
{}, false, false, 0, nullptr, ~0u, ~0u};

auto comp = [](const spv_opcode_desc_t& lhs, const spv_opcode_desc_t& rhs) {
return lhs.opcode < rhs.opcode;
Expand Down Expand Up @@ -189,6 +210,7 @@ const char* spvOpcodeString(const uint32_t opcode) {
spv_opcode_desc_t needle = {"", static_cast<spv::Op>(opcode),
0, nullptr,
0, {},
0, {},
false, false,
0, nullptr,
~0u, ~0u};
Expand Down
21 changes: 20 additions & 1 deletion source/operand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,29 @@ spv_result_t spvOperandTableNameLookup(spv_target_env,
// We consider the current operand as available as long as
// it is in the grammar. It might not be *valid* to use,
// but that should be checked by the validator, not by parsing.
//
// Exact match case
if (nameLength == strlen(entry.name) &&
!strncmp(entry.name, name, nameLength)) {
*pEntry = &entry;
return SPV_SUCCESS;
}

// Check the aliases. Ideally we would have a version of the table sorted
// by name and then we could iterate between the lower and upper bounds to
// restrict the amount comparisons. Fortunately, name-based lookups are
// mostly restricted to the assembler.
if (entry.numAliases > 0) {
for (uint32_t aliasIndex = 0; aliasIndex < entry.numAliases;
aliasIndex++) {
const auto alias = entry.aliases[aliasIndex];
const size_t aliasLength = strlen(alias);
if (nameLength == aliasLength && !strncmp(name, alias, nameLength)) {
*pEntry = &entry;
return SPV_SUCCESS;
}
}
}
}
}

Expand All @@ -83,7 +101,8 @@ spv_result_t spvOperandTableValueLookup(spv_target_env,
if (!table) return SPV_ERROR_INVALID_TABLE;
if (!pEntry) return SPV_ERROR_INVALID_POINTER;

spv_operand_desc_t needle = {"", value, 0, nullptr, 0, nullptr, {}, ~0u, ~0u};
spv_operand_desc_t needle = {"", value, 0, nullptr, 0, nullptr,
0, nullptr, {}, ~0u, ~0u};

auto comp = [](const spv_operand_desc_t& lhs, const spv_operand_desc_t& rhs) {
return lhs.value < rhs.value;
Expand Down
Loading

0 comments on commit c4fb839

Please sign in to comment.