From 42abaa099aab6ce5a1e7735e1caba89bab3d0327 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Fri, 24 May 2019 15:43:59 -0400 Subject: [PATCH] Remove MarkV and Stats code. (#2576) * Remove MarkV and Stats code. This Cl removes the MarkV and Stats code from SPIRV-Tools. This code was unused and currently un-maintained. --- .appveyor.yml | 2 +- Android.mk | 1 - CMakeLists.txt | 7 +- README.md | 2 - kokoro/android/build.sh | 2 +- kokoro/scripts/windows/build.bat | 2 +- source/CMakeLists.txt | 3 - source/comp/CMakeLists.txt | 52 - source/comp/bit_stream.cpp | 348 - source/comp/bit_stream.h | 280 - source/comp/huffman_codec.h | 389 - source/comp/markv.cpp | 112 - source/comp/markv.h | 74 - source/comp/markv_codec.cpp | 793 - source/comp/markv_codec.h | 337 - source/comp/markv_decoder.cpp | 925 - source/comp/markv_decoder.h | 175 - source/comp/markv_encoder.cpp | 486 - source/comp/markv_encoder.h | 167 - source/comp/markv_logger.h | 93 - source/comp/markv_model.h | 232 - source/comp/move_to_front.cpp | 456 - source/comp/move_to_front.h | 384 - source/id_descriptor.cpp | 78 - source/id_descriptor.h | 63 - test/CMakeLists.txt | 24 - test/bit_stream.cpp | 1025 -- test/comp/CMakeLists.txt | 29 - test/comp/markv_codec_test.cpp | 829 - test/huffman_codec.cpp | 317 - test/move_to_front_test.cpp | 828 - test/stats/CMakeLists.txt | 27 - test/stats/stats_aggregate_test.cpp | 438 - test/stats/stats_analyzer_test.cpp | 174 - tools/CMakeLists.txt | 23 +- tools/comp/markv.cpp | 385 - tools/comp/markv_model_factory.cpp | 50 - tools/comp/markv_model_factory.h | 37 - tools/comp/markv_model_shader.cpp | 84 - tools/comp/markv_model_shader.h | 47 - .../markv_model_shader_default_autogen.inc | 14519 ---------------- tools/stats/spirv_stats.cpp | 165 - tools/stats/spirv_stats.h | 93 - tools/stats/stats.cpp | 173 - tools/stats/stats_analyzer.cpp | 235 - tools/stats/stats_analyzer.h | 58 - 46 files changed, 8 insertions(+), 25015 deletions(-) delete mode 100644 source/comp/CMakeLists.txt delete mode 100644 source/comp/bit_stream.cpp delete mode 100644 source/comp/bit_stream.h delete mode 100644 source/comp/huffman_codec.h delete mode 100644 source/comp/markv.cpp delete mode 100644 source/comp/markv.h delete mode 100644 source/comp/markv_codec.cpp delete mode 100644 source/comp/markv_codec.h delete mode 100644 source/comp/markv_decoder.cpp delete mode 100644 source/comp/markv_decoder.h delete mode 100644 source/comp/markv_encoder.cpp delete mode 100644 source/comp/markv_encoder.h delete mode 100644 source/comp/markv_logger.h delete mode 100644 source/comp/markv_model.h delete mode 100644 source/comp/move_to_front.cpp delete mode 100644 source/comp/move_to_front.h delete mode 100644 source/id_descriptor.cpp delete mode 100644 source/id_descriptor.h delete mode 100644 test/bit_stream.cpp delete mode 100644 test/comp/CMakeLists.txt delete mode 100644 test/comp/markv_codec_test.cpp delete mode 100644 test/huffman_codec.cpp delete mode 100644 test/move_to_front_test.cpp delete mode 100644 test/stats/CMakeLists.txt delete mode 100644 test/stats/stats_aggregate_test.cpp delete mode 100644 test/stats/stats_analyzer_test.cpp delete mode 100644 tools/comp/markv.cpp delete mode 100644 tools/comp/markv_model_factory.cpp delete mode 100644 tools/comp/markv_model_factory.h delete mode 100644 tools/comp/markv_model_shader.cpp delete mode 100644 tools/comp/markv_model_shader.h delete mode 100644 tools/comp/markv_model_shader_default_autogen.inc delete mode 100644 tools/stats/spirv_stats.cpp delete mode 100644 tools/stats/spirv_stats.h delete mode 100644 tools/stats/stats.cpp delete mode 100644 tools/stats/stats_analyzer.cpp delete mode 100644 tools/stats/stats_analyzer.h diff --git a/.appveyor.yml b/.appveyor.yml index 669de030a..196f54584 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -59,7 +59,7 @@ build: build_script: - mkdir build && cd build - - cmake -GNinja -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF .. + - cmake -GNinja -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF .. - ninja install test_script: diff --git a/Android.mk b/Android.mk index a43142236..06d881193 100644 --- a/Android.mk +++ b/Android.mk @@ -13,7 +13,6 @@ SPVTOOLS_SRC_FILES := \ source/ext_inst.cpp \ source/enum_string_mapping.cpp \ source/extensions.cpp \ - source/id_descriptor.cpp \ source/libspirv.cpp \ source/name_mapper.cpp \ source/opcode.cpp \ diff --git a/CMakeLists.txt b/CMakeLists.txt index abe89d5b3..9f24e3863 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,10 @@ if(NOT ${SKIP_SPIRV_TOOLS_INSTALL}) endif() option(SPIRV_BUILD_COMPRESSION "Build SPIR-V compressing codec" OFF) +if(SPIRV_BUILD_COMPRESSION) + message(FATAL_ERROR "SPIR-V compression codec has been removed from SPIR-V tools. " + "Please remove SPIRV_BUILD_COMPRESSION from your build options.") +endif(SPIRV_BUILD_COMPRESSION) option(SPIRV_WERROR "Enable error on warning" ON) if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND (NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))) @@ -257,9 +261,6 @@ endif() set(SPIRV_LIBRARIES "-lSPIRV-Tools -lSPIRV-Tools-link -lSPIRV-Tools-opt") set(SPIRV_SHARED_LIBRARIES "-lSPIRV-Tools-shared") -if(SPIRV_BUILD_COMPRESSION) - set(SPIRV_LIBRARIES "${SPIRV_LIBRARIES} -lSPIRV-Tools-comp") -endif(SPIRV_BUILD_COMPRESSION) # Build pkg-config file # Use a first-class target so it's regenerated when relevant files are updated. diff --git a/README.md b/README.md index edc5ecaf6..9737f7e78 100644 --- a/README.md +++ b/README.md @@ -307,8 +307,6 @@ The following CMake options are supported: the command line tools. This will prevent the tests from being built. * `SPIRV_SKIP_EXECUTABLES={ON|OFF}`, default `OFF`- Build only the library, not the command line tools and tests. -* `SPIRV_BUILD_COMPRESSION={ON|OFF}`, default `OFF`- Build SPIR-V compressing - codec. * `SPIRV_USE_SANITIZER=`, default is no sanitizing - On UNIX platforms with an appropriate version of `clang` this option enables the use of the sanitizers documented [here][clang-sanitizers]. diff --git a/kokoro/android/build.sh b/kokoro/android/build.sh index e31744fd1..71d87b681 100644 --- a/kokoro/android/build.sh +++ b/kokoro/android/build.sh @@ -44,7 +44,7 @@ mkdir build && cd $SRC/build # Invoke the build. BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} echo $(date): Starting build... -cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-14 -DANDROID_ABI="armeabi-v7a with NEON" -DSPIRV_BUILD_COMPRESSION=ON -DSPIRV_SKIP_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_PATH -GNinja -DANDROID_NDK=$ANDROID_NDK .. +cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-14 -DANDROID_ABI="armeabi-v7a with NEON" -DSPIRV_SKIP_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_PATH -GNinja -DANDROID_NDK=$ANDROID_NDK .. echo $(date): Build everything... ninja diff --git a/kokoro/scripts/windows/build.bat b/kokoro/scripts/windows/build.bat index ef2470d86..a4f2bf007 100644 --- a/kokoro/scripts/windows/build.bat +++ b/kokoro/scripts/windows/build.bat @@ -63,7 +63,7 @@ if "%KOKORO_GITHUB_COMMIT%." == "." ( set BUILD_SHA=%KOKORO_GITHUB_COMMIT% ) -set CMAKE_FLAGS=-DCMAKE_INSTALL_PREFIX=%KOKORO_ARTIFACTS_DIR%\install -GNinja -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe +set CMAKE_FLAGS=-DCMAKE_INSTALL_PREFIX=%KOKORO_ARTIFACTS_DIR%\install -GNinja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe :: Skip building tests for VS2013 if %VS_VERSION% == 2013 ( diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1f96018c6..0c0820dd7 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -196,7 +196,6 @@ set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/pch_source.cpp PROPERTIES OBJECT_DEPENDS "${PCH_DEPENDS}") -add_subdirectory(comp) add_subdirectory(opt) add_subdirectory(reduce) add_subdirectory(link) @@ -221,7 +220,6 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.h ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.h ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h - ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.h ${CMAKE_CURRENT_SOURCE_DIR}/instruction.h ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_glsl_std_450_header.h ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_opencl_std_header.h @@ -254,7 +252,6 @@ set(SPIRV_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp ${CMAKE_CURRENT_SOURCE_DIR}/extensions.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.cpp ${CMAKE_CURRENT_SOURCE_DIR}/libspirv.cpp ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp diff --git a/source/comp/CMakeLists.txt b/source/comp/CMakeLists.txt deleted file mode 100644 index f65f9f670..000000000 --- a/source/comp/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if(SPIRV_BUILD_COMPRESSION) - add_library(SPIRV-Tools-comp - bit_stream.cpp - bit_stream.h - huffman_codec.h - markv_codec.cpp - markv_codec.h - markv.cpp - markv.h - markv_decoder.cpp - markv_decoder.h - markv_encoder.cpp - markv_encoder.h - markv_logger.h - move_to_front.h - move_to_front.cpp) - - spvtools_default_compile_options(SPIRV-Tools-comp) - target_include_directories(SPIRV-Tools-comp - PUBLIC ${spirv-tools_SOURCE_DIR}/include - PUBLIC ${SPIRV_HEADER_INCLUDE_DIR} - PRIVATE ${spirv-tools_BINARY_DIR} - ) - - target_link_libraries(SPIRV-Tools-comp - PUBLIC ${SPIRV_TOOLS}) - - set_property(TARGET SPIRV-Tools-comp PROPERTY FOLDER "SPIRV-Tools libraries") - spvtools_check_symbol_exports(SPIRV-Tools-comp) - - if(ENABLE_SPIRV_TOOLS_INSTALL) - install(TARGETS SPIRV-Tools-comp - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif(ENABLE_SPIRV_TOOLS_INSTALL) - -endif(SPIRV_BUILD_COMPRESSION) diff --git a/source/comp/bit_stream.cpp b/source/comp/bit_stream.cpp deleted file mode 100644 index a5769e03e..000000000 --- a/source/comp/bit_stream.cpp +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include - -#include "source/comp/bit_stream.h" - -namespace spvtools { -namespace comp { -namespace { - -// Returns if the system is little-endian. Unfortunately only works during -// runtime. -bool IsLittleEndian() { - // This constant value allows the detection of the host machine's endianness. - // Accessing it as an array of bytes is valid due to C++11 section 3.10 - // paragraph 10. - static const uint16_t kFF00 = 0xff00; - return reinterpret_cast(&kFF00)[0] == 0; -} - -// Copies bytes from the given buffer to a uint64_t buffer. -// Motivation: casting uint64_t* to uint8_t* is ok. Casting in the other -// direction is only advisable if uint8_t* is aligned to 64-bit word boundary. -std::vector ToBuffer64(const void* buffer, size_t num_bytes) { - std::vector out; - out.resize((num_bytes + 7) / 8, 0); - memcpy(out.data(), buffer, num_bytes); - return out; -} - -// Copies uint8_t buffer to a uint64_t buffer. -std::vector ToBuffer64(const std::vector& in) { - return ToBuffer64(in.data(), in.size()); -} - -// Returns uint64_t containing the same bits as |val|. -// Type size must be less than 8 bytes. -template -uint64_t ToU64(T val) { - static_assert(sizeof(T) <= 8, "Type size too big"); - uint64_t val64 = 0; - std::memcpy(&val64, &val, sizeof(T)); - return val64; -} - -// Returns value of type T containing the same bits as |val64|. -// Type size must be less than 8 bytes. Upper (unused) bits of |val64| must be -// zero (irrelevant, but is checked with assertion). -template -T FromU64(uint64_t val64) { - assert(sizeof(T) == 8 || (val64 >> (sizeof(T) * 8)) == 0); - static_assert(sizeof(T) <= 8, "Type size too big"); - T val = 0; - std::memcpy(&val, &val64, sizeof(T)); - return val; -} - -// Writes bits from |val| to |writer| in chunks of size |chunk_length|. -// Signal bit is used to signal if the reader should expect another chunk: -// 0 - no more chunks to follow -// 1 - more chunks to follow -// If number of written bits reaches |max_payload| last chunk is truncated. -void WriteVariableWidthInternal(BitWriterInterface* writer, uint64_t val, - size_t chunk_length, size_t max_payload) { - assert(chunk_length > 0); - assert(chunk_length < max_payload); - assert(max_payload == 64 || (val >> max_payload) == 0); - - if (val == 0) { - // Split in two writes for more readable logging. - writer->WriteBits(0, chunk_length); - writer->WriteBits(0, 1); - return; - } - - size_t payload_written = 0; - - while (val) { - if (payload_written + chunk_length >= max_payload) { - // This has to be the last chunk. - // There is no need for the signal bit and the chunk can be truncated. - const size_t left_to_write = max_payload - payload_written; - assert((val >> left_to_write) == 0); - writer->WriteBits(val, left_to_write); - break; - } - - writer->WriteBits(val, chunk_length); - payload_written += chunk_length; - val = val >> chunk_length; - - // Write a single bit to signal if there is more to come. - writer->WriteBits(val ? 1 : 0, 1); - } -} - -// Reads data written with WriteVariableWidthInternal. |chunk_length| and -// |max_payload| should be identical to those used to write the data. -// Returns false if the stream ends prematurely. -bool ReadVariableWidthInternal(BitReaderInterface* reader, uint64_t* val, - size_t chunk_length, size_t max_payload) { - assert(chunk_length > 0); - assert(chunk_length <= max_payload); - size_t payload_read = 0; - - while (payload_read + chunk_length < max_payload) { - uint64_t bits = 0; - if (reader->ReadBits(&bits, chunk_length) != chunk_length) return false; - - *val |= bits << payload_read; - payload_read += chunk_length; - - uint64_t more_to_come = 0; - if (reader->ReadBits(&more_to_come, 1) != 1) return false; - - if (!more_to_come) { - return true; - } - } - - // Need to read the last chunk which may be truncated. No signal bit follows. - uint64_t bits = 0; - const size_t left_to_read = max_payload - payload_read; - if (reader->ReadBits(&bits, left_to_read) != left_to_read) return false; - - *val |= bits << payload_read; - return true; -} - -// Calls WriteVariableWidthInternal with the right max_payload argument. -template -void WriteVariableWidthUnsigned(BitWriterInterface* writer, T val, - size_t chunk_length) { - static_assert(std::is_unsigned::value, "Type must be unsigned"); - static_assert(std::is_integral::value, "Type must be integral"); - WriteVariableWidthInternal(writer, val, chunk_length, sizeof(T) * 8); -} - -// Calls ReadVariableWidthInternal with the right max_payload argument. -template -bool ReadVariableWidthUnsigned(BitReaderInterface* reader, T* val, - size_t chunk_length) { - static_assert(std::is_unsigned::value, "Type must be unsigned"); - static_assert(std::is_integral::value, "Type must be integral"); - uint64_t val64 = 0; - if (!ReadVariableWidthInternal(reader, &val64, chunk_length, sizeof(T) * 8)) - return false; - *val = static_cast(val64); - assert(*val == val64); - return true; -} - -// Encodes signed |val| to an unsigned value and calls -// WriteVariableWidthInternal with the right max_payload argument. -template -void WriteVariableWidthSigned(BitWriterInterface* writer, T val, - size_t chunk_length, size_t zigzag_exponent) { - static_assert(std::is_signed::value, "Type must be signed"); - static_assert(std::is_integral::value, "Type must be integral"); - WriteVariableWidthInternal(writer, EncodeZigZag(val, zigzag_exponent), - chunk_length, sizeof(T) * 8); -} - -// Calls ReadVariableWidthInternal with the right max_payload argument -// and decodes the value. -template -bool ReadVariableWidthSigned(BitReaderInterface* reader, T* val, - size_t chunk_length, size_t zigzag_exponent) { - static_assert(std::is_signed::value, "Type must be signed"); - static_assert(std::is_integral::value, "Type must be integral"); - uint64_t encoded = 0; - if (!ReadVariableWidthInternal(reader, &encoded, chunk_length, sizeof(T) * 8)) - return false; - - const int64_t decoded = DecodeZigZag(encoded, zigzag_exponent); - - *val = static_cast(decoded); - assert(*val == decoded); - return true; -} - -} // namespace - -void BitWriterInterface::WriteVariableWidthU64(uint64_t val, - size_t chunk_length) { - WriteVariableWidthUnsigned(this, val, chunk_length); -} - -void BitWriterInterface::WriteVariableWidthU32(uint32_t val, - size_t chunk_length) { - WriteVariableWidthUnsigned(this, val, chunk_length); -} - -void BitWriterInterface::WriteVariableWidthU16(uint16_t val, - size_t chunk_length) { - WriteVariableWidthUnsigned(this, val, chunk_length); -} - -void BitWriterInterface::WriteVariableWidthS64(int64_t val, size_t chunk_length, - size_t zigzag_exponent) { - WriteVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -BitWriterWord64::BitWriterWord64(size_t reserve_bits) : end_(0) { - buffer_.reserve(NumBitsToNumWords<64>(reserve_bits)); -} - -void BitWriterWord64::WriteBits(uint64_t bits, size_t num_bits) { - // Check that |bits| and |num_bits| are valid and consistent. - assert(num_bits <= 64); - const bool is_little_endian = IsLittleEndian(); - assert(is_little_endian && "Big-endian architecture support not implemented"); - if (!is_little_endian) return; - - if (num_bits == 0) return; - - bits = GetLowerBits(bits, num_bits); - - EmitSequence(bits, num_bits); - - // Offset from the start of the current word. - const size_t offset = end_ % 64; - - if (offset == 0) { - // If no offset, simply add |bits| as a new word to the buffer_. - buffer_.push_back(bits); - } else { - // Shift bits and add them to the current word after offset. - const uint64_t first_word = bits << offset; - buffer_.back() |= first_word; - - // If we don't overflow to the next word, there is nothing more to do. - - if (offset + num_bits > 64) { - // We overflow to the next word. - const uint64_t second_word = bits >> (64 - offset); - // Add remaining bits as a new word to buffer_. - buffer_.push_back(second_word); - } - } - - // Move end_ into position for next write. - end_ += num_bits; - assert(buffer_.size() * 64 >= end_); -} - -bool BitReaderInterface::ReadVariableWidthU64(uint64_t* val, - size_t chunk_length) { - return ReadVariableWidthUnsigned(this, val, chunk_length); -} - -bool BitReaderInterface::ReadVariableWidthU32(uint32_t* val, - size_t chunk_length) { - return ReadVariableWidthUnsigned(this, val, chunk_length); -} - -bool BitReaderInterface::ReadVariableWidthU16(uint16_t* val, - size_t chunk_length) { - return ReadVariableWidthUnsigned(this, val, chunk_length); -} - -bool BitReaderInterface::ReadVariableWidthS64(int64_t* val, size_t chunk_length, - size_t zigzag_exponent) { - return ReadVariableWidthSigned(this, val, chunk_length, zigzag_exponent); -} - -BitReaderWord64::BitReaderWord64(std::vector&& buffer) - : buffer_(std::move(buffer)), pos_(0) {} - -BitReaderWord64::BitReaderWord64(const std::vector& buffer) - : buffer_(ToBuffer64(buffer)), pos_(0) {} - -BitReaderWord64::BitReaderWord64(const void* buffer, size_t num_bytes) - : buffer_(ToBuffer64(buffer, num_bytes)), pos_(0) {} - -size_t BitReaderWord64::ReadBits(uint64_t* bits, size_t num_bits) { - assert(num_bits <= 64); - const bool is_little_endian = IsLittleEndian(); - assert(is_little_endian && "Big-endian architecture support not implemented"); - if (!is_little_endian) return 0; - - if (ReachedEnd()) return 0; - - // Index of the current word. - const size_t index = pos_ / 64; - - // Bit position in the current word where we start reading. - const size_t offset = pos_ % 64; - - // Read all bits from the current word (it might be too much, but - // excessive bits will be removed later). - *bits = buffer_[index] >> offset; - - const size_t num_read_from_first_word = std::min(64 - offset, num_bits); - pos_ += num_read_from_first_word; - - if (pos_ >= buffer_.size() * 64) { - // Reached end of buffer_. - EmitSequence(*bits, num_read_from_first_word); - return num_read_from_first_word; - } - - if (offset + num_bits > 64) { - // Requested |num_bits| overflows to next word. - // Write all bits from the beginning of next word to *bits after offset. - *bits |= buffer_[index + 1] << (64 - offset); - pos_ += offset + num_bits - 64; - } - - // We likely have written more bits than requested. Clear excessive bits. - *bits = GetLowerBits(*bits, num_bits); - EmitSequence(*bits, num_bits); - return num_bits; -} - -bool BitReaderWord64::ReachedEnd() const { return pos_ >= buffer_.size() * 64; } - -bool BitReaderWord64::OnlyZeroesLeft() const { - if (ReachedEnd()) return true; - - const size_t index = pos_ / 64; - if (index < buffer_.size() - 1) return false; - - assert(index == buffer_.size() - 1); - - const size_t offset = pos_ % 64; - const uint64_t remaining_bits = buffer_[index] >> offset; - return !remaining_bits; -} - -} // namespace comp -} // namespace spvtools diff --git a/source/comp/bit_stream.h b/source/comp/bit_stream.h deleted file mode 100644 index 5f82344d6..000000000 --- a/source/comp/bit_stream.h +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Contains utils for reading, writing and debug printing bit streams. - -#ifndef SOURCE_COMP_BIT_STREAM_H_ -#define SOURCE_COMP_BIT_STREAM_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spvtools { -namespace comp { - -// Terminology: -// Bits - usually used for a uint64 word, first bit is the lowest. -// Stream - std::string of '0' and '1', read left-to-right, -// i.e. first bit is at the front and not at the end as in -// std::bitset::to_string(). -// Bitset - std::bitset corresponding to uint64 bits and to reverse(stream). - -// Converts number of bits to a respective number of chunks of size N. -// For example NumBitsToNumWords<8> returns how many bytes are needed to store -// |num_bits|. -template -inline size_t NumBitsToNumWords(size_t num_bits) { - return (num_bits + (N - 1)) / N; -} - -// Returns value of the same type as |in|, where all but the first |num_bits| -// are set to zero. -template -inline T GetLowerBits(T in, size_t num_bits) { - return sizeof(T) * 8 == num_bits ? in : in & T((T(1) << num_bits) - T(1)); -} - -// Encodes signed integer as unsigned. This is a generalized version of -// EncodeZigZag, designed to favor small positive numbers. -// Values are transformed in blocks of 2^|block_exponent|. -// If |block_exponent| is zero, then this degenerates into normal EncodeZigZag. -// Example when |block_exponent| is 1 (return value is the index): -// 0, 1, -1, -2, 2, 3, -3, -4, 4, 5, -5, -6, 6, 7, -7, -8 -// Example when |block_exponent| is 2: -// 0, 1, 2, 3, -1, -2, -3, -4, 4, 5, 6, 7, -5, -6, -7, -8 -inline uint64_t EncodeZigZag(int64_t val, size_t block_exponent) { - assert(block_exponent < 64); - const uint64_t uval = static_cast(val >= 0 ? val : -val - 1); - const uint64_t block_num = - ((uval >> block_exponent) << 1) + (val >= 0 ? 0 : 1); - const uint64_t pos = GetLowerBits(uval, block_exponent); - return (block_num << block_exponent) + pos; -} - -// Decodes signed integer encoded with EncodeZigZag. |block_exponent| must be -// the same. -inline int64_t DecodeZigZag(uint64_t val, size_t block_exponent) { - assert(block_exponent < 64); - const uint64_t block_num = val >> block_exponent; - const uint64_t pos = GetLowerBits(val, block_exponent); - if (block_num & 1) { - // Negative. - return -1LL - ((block_num >> 1) << block_exponent) - pos; - } else { - // Positive. - return ((block_num >> 1) << block_exponent) + pos; - } -} - -// Converts first |num_bits| stored in uint64 to a left-to-right stream of bits. -inline std::string BitsToStream(uint64_t bits, size_t num_bits = 64) { - std::bitset<64> bitset(bits); - std::string str = bitset.to_string().substr(64 - num_bits); - std::reverse(str.begin(), str.end()); - return str; -} - -// Base class for writing sequences of bits. -class BitWriterInterface { - public: - BitWriterInterface() = default; - virtual ~BitWriterInterface() = default; - - // Writes lower |num_bits| in |bits| to the stream. - // |num_bits| must be no greater than 64. - virtual void WriteBits(uint64_t bits, size_t num_bits) = 0; - - // Writes bits from value of type |T| to the stream. No encoding is done. - // Always writes 8 * sizeof(T) bits. - template - void WriteUnencoded(T val) { - static_assert(sizeof(T) <= 64, "Type size too large"); - uint64_t bits = 0; - memcpy(&bits, &val, sizeof(T)); - WriteBits(bits, sizeof(T) * 8); - } - - // Writes |val| in chunks of size |chunk_length| followed by a signal bit: - // 0 - no more chunks to follow - // 1 - more chunks to follow - // for example 255 is encoded into 1111 1 1111 0 for chunk length 4. - // The last chunk can be truncated and signal bit omitted, if the entire - // payload (for example 16 bit for uint16_t has already been written). - void WriteVariableWidthU64(uint64_t val, size_t chunk_length); - void WriteVariableWidthU32(uint32_t val, size_t chunk_length); - void WriteVariableWidthU16(uint16_t val, size_t chunk_length); - void WriteVariableWidthS64(int64_t val, size_t chunk_length, - size_t zigzag_exponent); - - // Returns number of bits written. - virtual size_t GetNumBits() const = 0; - - // Provides direct access to the buffer data if implemented. - virtual const uint8_t* GetData() const { return nullptr; } - - // Returns buffer size in bytes. - size_t GetDataSizeBytes() const { return NumBitsToNumWords<8>(GetNumBits()); } - - // Generates and returns byte array containing written bits. - virtual std::vector GetDataCopy() const = 0; - - BitWriterInterface(const BitWriterInterface&) = delete; - BitWriterInterface& operator=(const BitWriterInterface&) = delete; -}; - -// This class is an implementation of BitWriterInterface, using -// std::vector to store written bits. -class BitWriterWord64 : public BitWriterInterface { - public: - explicit BitWriterWord64(size_t reserve_bits = 64); - - void WriteBits(uint64_t bits, size_t num_bits) override; - - size_t GetNumBits() const override { return end_; } - - const uint8_t* GetData() const override { - return reinterpret_cast(buffer_.data()); - } - - std::vector GetDataCopy() const override { - return std::vector(GetData(), GetData() + GetDataSizeBytes()); - } - - // Sets callback to emit bit sequences after every write. - void SetCallback(std::function callback) { - callback_ = callback; - } - - protected: - // Sends string generated from arguments to callback_ if defined. - void EmitSequence(uint64_t bits, size_t num_bits) const { - if (callback_) callback_(BitsToStream(bits, num_bits)); - } - - private: - std::vector buffer_; - // Total number of bits written so far. Named 'end' as analogy to std::end(). - size_t end_; - - // If not null, the writer will use the callback to emit the written bit - // sequence as a string of '0' and '1'. - std::function callback_; -}; - -// Base class for reading sequences of bits. -class BitReaderInterface { - public: - BitReaderInterface() {} - virtual ~BitReaderInterface() {} - - // Reads |num_bits| from the stream, stores them in |bits|. - // Returns number of read bits. |num_bits| must be no greater than 64. - virtual size_t ReadBits(uint64_t* bits, size_t num_bits) = 0; - - // Reads 8 * sizeof(T) bits and stores them in |val|. - template - bool ReadUnencoded(T* val) { - static_assert(sizeof(T) <= 64, "Type size too large"); - uint64_t bits = 0; - const size_t num_read = ReadBits(&bits, sizeof(T) * 8); - if (num_read != sizeof(T) * 8) return false; - memcpy(val, &bits, sizeof(T)); - return true; - } - - // Returns number of bits already read. - virtual size_t GetNumReadBits() const = 0; - - // These two functions define 'hard' and 'soft' EOF. - // - // Returns true if the end of the buffer was reached. - virtual bool ReachedEnd() const = 0; - // Returns true if we reached the end of the buffer or are nearing it and only - // zero bits are left to read. Implementations of this function are allowed to - // commit a "false negative" error if the end of the buffer was not reached, - // i.e. it can return false even if indeed only zeroes are left. - // It is assumed that the consumer expects that - // the buffer stream ends with padding zeroes, and would accept this as a - // 'soft' EOF. Implementations of this class do not necessarily need to - // implement this, default behavior can simply delegate to ReachedEnd(). - virtual bool OnlyZeroesLeft() const { return ReachedEnd(); } - - // Reads value encoded with WriteVariableWidthXXX (see BitWriterInterface). - // Reader and writer must use the same |chunk_length| and variable type. - // Returns true on success, false if the bit stream ends prematurely. - bool ReadVariableWidthU64(uint64_t* val, size_t chunk_length); - bool ReadVariableWidthU32(uint32_t* val, size_t chunk_length); - bool ReadVariableWidthU16(uint16_t* val, size_t chunk_length); - bool ReadVariableWidthS64(int64_t* val, size_t chunk_length, - size_t zigzag_exponent); - - BitReaderInterface(const BitReaderInterface&) = delete; - BitReaderInterface& operator=(const BitReaderInterface&) = delete; -}; - -// This class is an implementation of BitReaderInterface which accepts both -// uint8_t and uint64_t buffers as input. uint64_t buffers are consumed and -// owned. uint8_t buffers are copied. -class BitReaderWord64 : public BitReaderInterface { - public: - // Consumes and owns the buffer. - explicit BitReaderWord64(std::vector&& buffer); - - // Copies the buffer and casts it to uint64. - // Consuming the original buffer and casting it to uint64 is difficult, - // as it would potentially cause data misalignment and poor performance. - explicit BitReaderWord64(const std::vector& buffer); - BitReaderWord64(const void* buffer, size_t num_bytes); - - size_t ReadBits(uint64_t* bits, size_t num_bits) override; - - size_t GetNumReadBits() const override { return pos_; } - - bool ReachedEnd() const override; - bool OnlyZeroesLeft() const override; - - BitReaderWord64() = delete; - - // Sets callback to emit bit sequences after every read. - void SetCallback(std::function callback) { - callback_ = callback; - } - - protected: - // Sends string generated from arguments to callback_ if defined. - void EmitSequence(uint64_t bits, size_t num_bits) const { - if (callback_) callback_(BitsToStream(bits, num_bits)); - } - - private: - const std::vector buffer_; - size_t pos_; - - // If not null, the reader will use the callback to emit the read bit - // sequence as a string of '0' and '1'. - std::function callback_; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_BIT_STREAM_H_ diff --git a/source/comp/huffman_codec.h b/source/comp/huffman_codec.h deleted file mode 100644 index 166021614..000000000 --- a/source/comp/huffman_codec.h +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Contains utils for reading, writing and debug printing bit streams. - -#ifndef SOURCE_COMP_HUFFMAN_CODEC_H_ -#define SOURCE_COMP_HUFFMAN_CODEC_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace spvtools { -namespace comp { - -// Used to generate and apply a Huffman coding scheme. -// |Val| is the type of variable being encoded (for example a string or a -// literal). -template -class HuffmanCodec { - public: - // Huffman tree node. - struct Node { - Node() {} - - // Creates Node from serialization leaving weight and id undefined. - Node(const Val& in_value, uint32_t in_left, uint32_t in_right) - : value(in_value), left(in_left), right(in_right) {} - - Val value = Val(); - uint32_t weight = 0; - // Ids are issued sequentially starting from 1. Ids are used as an ordering - // tie-breaker, to make sure that the ordering (and resulting coding scheme) - // are consistent accross multiple platforms. - uint32_t id = 0; - // Handles of children. - uint32_t left = 0; - uint32_t right = 0; - }; - - // Creates Huffman codec from a histogramm. - // Histogramm counts must not be zero. - explicit HuffmanCodec(const std::map& hist) { - if (hist.empty()) return; - - // Heuristic estimate. - nodes_.reserve(3 * hist.size()); - - // Create NIL. - CreateNode(); - - // The queue is sorted in ascending order by weight (or by node id if - // weights are equal). - std::vector queue_vector; - queue_vector.reserve(hist.size()); - std::priority_queue, - std::function> - queue(std::bind(&HuffmanCodec::LeftIsBigger, this, - std::placeholders::_1, std::placeholders::_2), - std::move(queue_vector)); - - // Put all leaves in the queue. - for (const auto& pair : hist) { - const uint32_t node = CreateNode(); - MutableValueOf(node) = pair.first; - MutableWeightOf(node) = pair.second; - assert(WeightOf(node)); - queue.push(node); - } - - // Form the tree by combining two subtrees with the least weight, - // and pushing the root of the new tree in the queue. - while (true) { - // We push a node at the end of each iteration, so the queue is never - // supposed to be empty at this point, unless there are no leaves, but - // that case was already handled. - assert(!queue.empty()); - const uint32_t right = queue.top(); - queue.pop(); - - // If the queue is empty at this point, then the last node is - // the root of the complete Huffman tree. - if (queue.empty()) { - root_ = right; - break; - } - - const uint32_t left = queue.top(); - queue.pop(); - - // Combine left and right into a new tree and push it into the queue. - const uint32_t parent = CreateNode(); - MutableWeightOf(parent) = WeightOf(right) + WeightOf(left); - MutableLeftOf(parent) = left; - MutableRightOf(parent) = right; - queue.push(parent); - } - - // Traverse the tree and form encoding table. - CreateEncodingTable(); - } - - // Creates Huffman codec from saved tree structure. - // |nodes| is the list of nodes of the tree, nodes[0] being NIL. - // |root_handle| is the index of the root node. - HuffmanCodec(uint32_t root_handle, std::vector&& nodes) { - nodes_ = std::move(nodes); - assert(!nodes_.empty()); - assert(root_handle > 0 && root_handle < nodes_.size()); - assert(!LeftOf(0) && !RightOf(0)); - - root_ = root_handle; - - // Traverse the tree and form encoding table. - CreateEncodingTable(); - } - - // Serializes the codec in the following text format: - // (, { - // {0, 0, 0}, - // {val1, left1, right1}, - // {val2, left2, right2}, - // ... - // }) - std::string SerializeToText(int indent_num_whitespaces) const { - const bool value_is_text = std::is_same::value; - - const std::string indent1 = std::string(indent_num_whitespaces, ' '); - const std::string indent2 = std::string(indent_num_whitespaces + 2, ' '); - - std::stringstream code; - code << "(" << root_ << ", {\n"; - - for (const Node& node : nodes_) { - code << indent2 << "{"; - if (value_is_text) code << "\""; - code << node.value; - if (value_is_text) code << "\""; - code << ", " << node.left << ", " << node.right << "},\n"; - } - - code << indent1 << "})"; - - return code.str(); - } - - // Prints the Huffman tree in the following format: - // w------w------'x' - // w------'y' - // Where w stands for the weight of the node. - // Right tree branches appear above left branches. Taking the right path - // adds 1 to the code, taking the left adds 0. - void PrintTree(std::ostream& out) const { PrintTreeInternal(out, root_, 0); } - - // Traverses the tree and prints the Huffman table: value, code - // and optionally node weight for every leaf. - void PrintTable(std::ostream& out, bool print_weights = true) { - std::queue> queue; - queue.emplace(root_, ""); - - while (!queue.empty()) { - const uint32_t node = queue.front().first; - const std::string code = queue.front().second; - queue.pop(); - if (!RightOf(node) && !LeftOf(node)) { - out << ValueOf(node); - if (print_weights) out << " " << WeightOf(node); - out << " " << code << std::endl; - } else { - if (LeftOf(node)) queue.emplace(LeftOf(node), code + "0"); - - if (RightOf(node)) queue.emplace(RightOf(node), code + "1"); - } - } - } - - // Returns the Huffman table. The table was built at at construction time, - // this function just returns a const reference. - const std::unordered_map>& GetEncodingTable() - const { - return encoding_table_; - } - - // Encodes |val| and stores its Huffman code in the lower |num_bits| of - // |bits|. Returns false of |val| is not in the Huffman table. - bool Encode(const Val& val, uint64_t* bits, size_t* num_bits) const { - auto it = encoding_table_.find(val); - if (it == encoding_table_.end()) return false; - *bits = it->second.first; - *num_bits = it->second.second; - return true; - } - - // Reads bits one-by-one using callback |read_bit| until a match is found. - // Matching value is stored in |val|. Returns false if |read_bit| terminates - // before a code was mathced. - // |read_bit| has type bool func(bool* bit). When called, the next bit is - // stored in |bit|. |read_bit| returns false if the stream terminates - // prematurely. - bool DecodeFromStream(const std::function& read_bit, - Val* val) const { - uint32_t node = root_; - while (true) { - assert(node); - - if (!RightOf(node) && !LeftOf(node)) { - *val = ValueOf(node); - return true; - } - - bool go_right; - if (!read_bit(&go_right)) return false; - - if (go_right) - node = RightOf(node); - else - node = LeftOf(node); - } - - assert(0); - return false; - } - - private: - // Returns value of the node referenced by |handle|. - Val ValueOf(uint32_t node) const { return nodes_.at(node).value; } - - // Returns left child of |node|. - uint32_t LeftOf(uint32_t node) const { return nodes_.at(node).left; } - - // Returns right child of |node|. - uint32_t RightOf(uint32_t node) const { return nodes_.at(node).right; } - - // Returns weight of |node|. - uint32_t WeightOf(uint32_t node) const { return nodes_.at(node).weight; } - - // Returns id of |node|. - uint32_t IdOf(uint32_t node) const { return nodes_.at(node).id; } - - // Returns mutable reference to value of |node|. - Val& MutableValueOf(uint32_t node) { - assert(node); - return nodes_.at(node).value; - } - - // Returns mutable reference to handle of left child of |node|. - uint32_t& MutableLeftOf(uint32_t node) { - assert(node); - return nodes_.at(node).left; - } - - // Returns mutable reference to handle of right child of |node|. - uint32_t& MutableRightOf(uint32_t node) { - assert(node); - return nodes_.at(node).right; - } - - // Returns mutable reference to weight of |node|. - uint32_t& MutableWeightOf(uint32_t node) { return nodes_.at(node).weight; } - - // Returns mutable reference to id of |node|. - uint32_t& MutableIdOf(uint32_t node) { return nodes_.at(node).id; } - - // Returns true if |left| has bigger weight than |right|. Node ids are - // used as tie-breaker. - bool LeftIsBigger(uint32_t left, uint32_t right) const { - if (WeightOf(left) == WeightOf(right)) { - assert(IdOf(left) != IdOf(right)); - return IdOf(left) > IdOf(right); - } - return WeightOf(left) > WeightOf(right); - } - - // Prints subtree (helper function used by PrintTree). - void PrintTreeInternal(std::ostream& out, uint32_t node, size_t depth) const { - if (!node) return; - - const size_t kTextFieldWidth = 7; - - if (!RightOf(node) && !LeftOf(node)) { - out << ValueOf(node) << std::endl; - } else { - if (RightOf(node)) { - std::stringstream label; - label << std::setfill('-') << std::left << std::setw(kTextFieldWidth) - << WeightOf(RightOf(node)); - out << label.str(); - PrintTreeInternal(out, RightOf(node), depth + 1); - } - - if (LeftOf(node)) { - out << std::string(depth * kTextFieldWidth, ' '); - std::stringstream label; - label << std::setfill('-') << std::left << std::setw(kTextFieldWidth) - << WeightOf(LeftOf(node)); - out << label.str(); - PrintTreeInternal(out, LeftOf(node), depth + 1); - } - } - } - - // Traverses the Huffman tree and saves paths to the leaves as bit - // sequences to encoding_table_. - void CreateEncodingTable() { - struct Context { - Context(uint32_t in_node, uint64_t in_bits, size_t in_depth) - : node(in_node), bits(in_bits), depth(in_depth) {} - uint32_t node; - // Huffman tree depth cannot exceed 64 as histogramm counts are expected - // to be positive and limited by numeric_limits::max(). - // For practical applications tree depth would be much smaller than 64. - uint64_t bits; - size_t depth; - }; - - std::queue queue; - queue.emplace(root_, 0, 0); - - while (!queue.empty()) { - const Context& context = queue.front(); - const uint32_t node = context.node; - const uint64_t bits = context.bits; - const size_t depth = context.depth; - queue.pop(); - - if (!RightOf(node) && !LeftOf(node)) { - auto insertion_result = encoding_table_.emplace( - ValueOf(node), std::pair(bits, depth)); - assert(insertion_result.second); - (void)insertion_result; - } else { - if (LeftOf(node)) queue.emplace(LeftOf(node), bits, depth + 1); - - if (RightOf(node)) - queue.emplace(RightOf(node), bits | (1ULL << depth), depth + 1); - } - } - } - - // Creates new Huffman tree node and stores it in the deleter array. - uint32_t CreateNode() { - const uint32_t handle = static_cast(nodes_.size()); - nodes_.emplace_back(Node()); - nodes_.back().id = next_node_id_++; - return handle; - } - - // Huffman tree root handle. - uint32_t root_ = 0; - - // Huffman tree deleter. - std::vector nodes_; - - // Encoding table value -> {bits, num_bits}. - // Huffman codes are expected to never exceed 64 bit length (this is in fact - // impossible if frequencies are stored as uint32_t). - std::unordered_map> encoding_table_; - - // Next node id issued by CreateNode(); - uint32_t next_node_id_ = 1; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_HUFFMAN_CODEC_H_ diff --git a/source/comp/markv.cpp b/source/comp/markv.cpp deleted file mode 100644 index 736bc51ba..000000000 --- a/source/comp/markv.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/comp/markv.h" - -#include "source/comp/markv_decoder.h" -#include "source/comp/markv_encoder.h" - -namespace spvtools { -namespace comp { -namespace { - -spv_result_t EncodeHeader(void* user_data, spv_endianness_t endian, - uint32_t magic, uint32_t version, uint32_t generator, - uint32_t id_bound, uint32_t schema) { - MarkvEncoder* encoder = reinterpret_cast(user_data); - return encoder->EncodeHeader(endian, magic, version, generator, id_bound, - schema); -} - -spv_result_t EncodeInstruction(void* user_data, - const spv_parsed_instruction_t* inst) { - MarkvEncoder* encoder = reinterpret_cast(user_data); - return encoder->EncodeInstruction(*inst); -} - -} // namespace - -spv_result_t SpirvToMarkv( - spv_const_context context, const std::vector& spirv, - const MarkvCodecOptions& options, const MarkvModel& markv_model, - MessageConsumer message_consumer, MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer, std::vector* markv) { - spv_context_t hijack_context = *context; - SetContextMessageConsumer(&hijack_context, message_consumer); - - spv_validator_options validator_options = - MarkvDecoder::GetValidatorOptions(options); - if (validator_options) { - spv_const_binary_t spirv_binary = {spirv.data(), spirv.size()}; - const spv_result_t result = spvValidateWithOptions( - &hijack_context, validator_options, &spirv_binary, nullptr); - if (result != SPV_SUCCESS) return result; - } - - MarkvEncoder encoder(&hijack_context, options, &markv_model); - - spv_position_t position = {}; - if (log_consumer || debug_consumer) { - encoder.CreateLogger(log_consumer, debug_consumer); - - spv_text text = nullptr; - if (spvBinaryToText(&hijack_context, spirv.data(), spirv.size(), - SPV_BINARY_TO_TEXT_OPTION_NO_HEADER, &text, - nullptr) != SPV_SUCCESS) { - return DiagnosticStream(position, hijack_context.consumer, "", - SPV_ERROR_INVALID_BINARY) - << "Failed to disassemble SPIR-V binary."; - } - assert(text); - encoder.SetDisassembly(std::string(text->str, text->length)); - spvTextDestroy(text); - } - - if (spvBinaryParse(&hijack_context, &encoder, spirv.data(), spirv.size(), - EncodeHeader, EncodeInstruction, nullptr) != SPV_SUCCESS) { - return DiagnosticStream(position, hijack_context.consumer, "", - SPV_ERROR_INVALID_BINARY) - << "Unable to encode to MARK-V."; - } - - *markv = encoder.GetMarkvBinary(); - return SPV_SUCCESS; -} - -spv_result_t MarkvToSpirv( - spv_const_context context, const std::vector& markv, - const MarkvCodecOptions& options, const MarkvModel& markv_model, - MessageConsumer message_consumer, MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer, std::vector* spirv) { - spv_position_t position = {}; - spv_context_t hijack_context = *context; - SetContextMessageConsumer(&hijack_context, message_consumer); - - MarkvDecoder decoder(&hijack_context, markv, options, &markv_model); - - if (log_consumer || debug_consumer) - decoder.CreateLogger(log_consumer, debug_consumer); - - if (decoder.DecodeModule(spirv) != SPV_SUCCESS) { - return DiagnosticStream(position, hijack_context.consumer, "", - SPV_ERROR_INVALID_BINARY) - << "Unable to decode MARK-V."; - } - - assert(!spirv->empty()); - return SPV_SUCCESS; -} - -} // namespace comp -} // namespace spvtools diff --git a/source/comp/markv.h b/source/comp/markv.h deleted file mode 100644 index 587086f91..000000000 --- a/source/comp/markv.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// MARK-V is a compression format for SPIR-V binaries. It strips away -// non-essential information (such as result ids which can be regenerated) and -// uses various bit reduction techiniques to reduce the size of the binary and -// make it more similar to other compressed SPIR-V files to further improve -// compression of the dataset. - -#ifndef SOURCE_COMP_MARKV_H_ -#define SOURCE_COMP_MARKV_H_ - -#include "spirv-tools/libspirv.hpp" - -namespace spvtools { -namespace comp { - -class MarkvModel; - -struct MarkvCodecOptions { - bool validate_spirv_binary = false; -}; - -// Debug callback. Called once per instruction. -// |words| is instruction SPIR-V words. -// |bits| is a textual representation of the MARK-V bit sequence used to encode -// the instruction (char '0' for 0, char '1' for 1). -// |comment| contains all logs generated while processing the instruction. -using MarkvDebugConsumer = - std::function& words, - const std::string& bits, const std::string& comment)>; - -// Logging callback. Called often (if decoder reads a single bit, the log -// consumer will receive 1 character string with that bit). -// This callback is more suitable for continous output than MarkvDebugConsumer, -// for example if the codec crashes it would allow to pinpoint on which operand -// or bit the crash happened. -// |snippet| could be any atomic fragment of text logged by the codec. It can -// contain a paragraph of text with newlines, or can be just one character. -using MarkvLogConsumer = std::function; - -// Encodes the given SPIR-V binary to MARK-V binary. -// |log_consumer| is optional (pass MarkvLogConsumer() to disable). -// |debug_consumer| is optional (pass MarkvDebugConsumer() to disable). -spv_result_t SpirvToMarkv( - spv_const_context context, const std::vector& spirv, - const MarkvCodecOptions& options, const MarkvModel& markv_model, - MessageConsumer message_consumer, MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer, std::vector* markv); - -// Decodes a SPIR-V binary from the given MARK-V binary. -// |log_consumer| is optional (pass MarkvLogConsumer() to disable). -// |debug_consumer| is optional (pass MarkvDebugConsumer() to disable). -spv_result_t MarkvToSpirv( - spv_const_context context, const std::vector& markv, - const MarkvCodecOptions& options, const MarkvModel& markv_model, - MessageConsumer message_consumer, MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer, std::vector* spirv); - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MARKV_H_ diff --git a/source/comp/markv_codec.cpp b/source/comp/markv_codec.cpp deleted file mode 100644 index ae3ce79f2..000000000 --- a/source/comp/markv_codec.cpp +++ /dev/null @@ -1,793 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// MARK-V is a compression format for SPIR-V binaries. It strips away -// non-essential information (such as result IDs which can be regenerated) and -// uses various bit reduction techniques to reduce the size of the binary. - -#include "source/comp/markv_codec.h" - -#include "source/comp/markv_logger.h" -#include "source/latest_version_glsl_std_450_header.h" -#include "source/latest_version_opencl_std_header.h" -#include "source/opcode.h" -#include "source/util/make_unique.h" - -namespace spvtools { -namespace comp { -namespace { - -// Custom hash function used to produce short descriptors. -uint32_t ShortHashU32Array(const std::vector& words) { - // The hash function is a sum of hashes of each word seeded by word index. - // Knuth's multiplicative hash is used to hash the words. - const uint32_t kKnuthMulHash = 2654435761; - uint32_t val = 0; - for (uint32_t i = 0; i < words.size(); ++i) { - val += (words[i] + i + 123) * kKnuthMulHash; - } - return 1 + val % ((1 << MarkvCodec::kShortDescriptorNumBits) - 1); -} - -// Returns a set of mtf rank codecs based on a plausible hand-coded -// distribution. -std::map>> -GetMtfHuffmanCodecs() { - std::map>> codecs; - - std::unique_ptr> codec; - - codec = MakeUnique>(std::map({ - {0, 5}, - {1, 40}, - {2, 10}, - {3, 5}, - {4, 5}, - {5, 5}, - {6, 3}, - {7, 3}, - {8, 3}, - {9, 3}, - {MarkvCodec::kMtfRankEncodedByValueSignal, 10}, - })); - codecs.emplace(kMtfAll, std::move(codec)); - - codec = MakeUnique>(std::map({ - {1, 50}, - {2, 20}, - {3, 5}, - {4, 5}, - {5, 2}, - {6, 1}, - {7, 1}, - {8, 1}, - {9, 1}, - {MarkvCodec::kMtfRankEncodedByValueSignal, 10}, - })); - codecs.emplace(kMtfGenericNonZeroRank, std::move(codec)); - - return codecs; -} - -} // namespace - -const uint32_t MarkvCodec::kMarkvMagicNumber = 0x07230303; - -const uint32_t MarkvCodec::kMtfSmallestRankEncodedByValue = 10; - -const uint32_t MarkvCodec::kMtfRankEncodedByValueSignal = - std::numeric_limits::max(); - -const uint32_t MarkvCodec::kShortDescriptorNumBits = 8; - -const size_t MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte = 8; - -MarkvCodec::MarkvCodec(spv_const_context context, - spv_validator_options validator_options, - const MarkvModel* model) - : validator_options_(validator_options), - grammar_(context), - model_(model), - short_id_descriptors_(ShortHashU32Array), - mtf_huffman_codecs_(GetMtfHuffmanCodecs()), - context_(context) {} - -MarkvCodec::~MarkvCodec() { spvValidatorOptionsDestroy(validator_options_); } - -MarkvCodec::MarkvHeader::MarkvHeader() - : magic_number(MarkvCodec::kMarkvMagicNumber), - markv_version(MarkvCodec::GetMarkvVersion()) {} - -// Defines and returns current MARK-V version. -// static -uint32_t MarkvCodec::GetMarkvVersion() { - const uint32_t kVersionMajor = 1; - const uint32_t kVersionMinor = 4; - return kVersionMinor | (kVersionMajor << 16); -} - -size_t MarkvCodec::GetNumBitsToNextByte(size_t bit_pos) const { - return (8 - (bit_pos % 8)) % 8; -} - -// Returns true if the opcode has a fixed number of operands. May return a -// false negative. -bool MarkvCodec::OpcodeHasFixedNumberOfOperands(SpvOp opcode) const { - switch (opcode) { - // TODO(atgoo@github.com) This is not a complete list. - case SpvOpNop: - case SpvOpName: - case SpvOpUndef: - case SpvOpSizeOf: - case SpvOpLine: - case SpvOpNoLine: - case SpvOpDecorationGroup: - case SpvOpExtension: - case SpvOpExtInstImport: - case SpvOpMemoryModel: - case SpvOpCapability: - case SpvOpTypeVoid: - case SpvOpTypeBool: - case SpvOpTypeInt: - case SpvOpTypeFloat: - case SpvOpTypeVector: - case SpvOpTypeMatrix: - case SpvOpTypeSampler: - case SpvOpTypeSampledImage: - case SpvOpTypeArray: - case SpvOpTypePointer: - case SpvOpConstantTrue: - case SpvOpConstantFalse: - case SpvOpLabel: - case SpvOpBranch: - case SpvOpFunction: - case SpvOpFunctionParameter: - case SpvOpFunctionEnd: - case SpvOpBitcast: - case SpvOpCopyObject: - case SpvOpTranspose: - case SpvOpSNegate: - case SpvOpFNegate: - case SpvOpIAdd: - case SpvOpFAdd: - case SpvOpISub: - case SpvOpFSub: - case SpvOpIMul: - case SpvOpFMul: - case SpvOpUDiv: - case SpvOpSDiv: - case SpvOpFDiv: - case SpvOpUMod: - case SpvOpSRem: - case SpvOpSMod: - case SpvOpFRem: - case SpvOpFMod: - case SpvOpVectorTimesScalar: - case SpvOpMatrixTimesScalar: - case SpvOpVectorTimesMatrix: - case SpvOpMatrixTimesVector: - case SpvOpMatrixTimesMatrix: - case SpvOpOuterProduct: - case SpvOpDot: - return true; - default: - break; - } - return false; -} - -void MarkvCodec::ProcessCurInstruction() { - instructions_.emplace_back(new val::Instruction(&inst_)); - - const SpvOp opcode = SpvOp(inst_.opcode); - - if (inst_.result_id) { - id_to_def_instruction_.emplace(inst_.result_id, instructions_.back().get()); - - // Collect ids local to the current function. - if (cur_function_id_) { - ids_local_to_cur_function_.push_back(inst_.result_id); - } - - // Starting new function. - if (opcode == SpvOpFunction) { - cur_function_id_ = inst_.result_id; - cur_function_return_type_ = inst_.type_id; - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - multi_mtf_.Insert(GetMtfFunctionWithReturnType(inst_.type_id), - inst_.result_id); - } - - // Store function parameter types in a queue, so that we know which types - // to expect in the following OpFunctionParameter instructions. - const val::Instruction* def_inst = FindDef(inst_.words[4]); - assert(def_inst); - assert(def_inst->opcode() == SpvOpTypeFunction); - for (uint32_t i = 3; i < def_inst->words().size(); ++i) { - remaining_function_parameter_types_.push_back(def_inst->word(i)); - } - } - } - - // Remove local ids from MTFs if function end. - if (opcode == SpvOpFunctionEnd) { - cur_function_id_ = 0; - for (uint32_t id : ids_local_to_cur_function_) multi_mtf_.RemoveFromAll(id); - ids_local_to_cur_function_.clear(); - assert(remaining_function_parameter_types_.empty()); - } - - if (!inst_.result_id) return; - - { - // Save the result ID to type ID mapping. - // In the grammar, type ID always appears before result ID. - // A regular value maps to its type. Some instructions (e.g. OpLabel) - // have no type Id, and will map to 0. The result Id for a - // type-generating instruction (e.g. OpTypeInt) maps to itself. - auto insertion_result = id_to_type_id_.emplace( - inst_.result_id, spvOpcodeGeneratesType(SpvOp(inst_.opcode)) - ? inst_.result_id - : inst_.type_id); - (void)insertion_result; - assert(insertion_result.second); - } - - // Add result_id to MTFs. - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - switch (opcode) { - case SpvOpTypeFloat: - case SpvOpTypeInt: - case SpvOpTypeBool: - case SpvOpTypeVector: - case SpvOpTypePointer: - case SpvOpExtInstImport: - case SpvOpTypeSampledImage: - case SpvOpTypeImage: - case SpvOpTypeSampler: - multi_mtf_.Insert(GetMtfIdGeneratedByOpcode(opcode), inst_.result_id); - break; - default: - break; - } - - if (spvOpcodeIsComposite(opcode)) { - multi_mtf_.Insert(kMtfTypeComposite, inst_.result_id); - } - - if (opcode == SpvOpLabel) { - multi_mtf_.InsertOrPromote(kMtfLabel, inst_.result_id); - } - - if (opcode == SpvOpTypeInt) { - multi_mtf_.Insert(kMtfTypeScalar, inst_.result_id); - multi_mtf_.Insert(kMtfTypeIntScalarOrVector, inst_.result_id); - } - - if (opcode == SpvOpTypeFloat) { - multi_mtf_.Insert(kMtfTypeScalar, inst_.result_id); - multi_mtf_.Insert(kMtfTypeFloatScalarOrVector, inst_.result_id); - } - - if (opcode == SpvOpTypeBool) { - multi_mtf_.Insert(kMtfTypeScalar, inst_.result_id); - multi_mtf_.Insert(kMtfTypeBoolScalarOrVector, inst_.result_id); - } - - if (opcode == SpvOpTypeVector) { - const uint32_t component_type_id = inst_.words[2]; - const uint32_t size = inst_.words[3]; - if (multi_mtf_.HasValue(GetMtfIdGeneratedByOpcode(SpvOpTypeFloat), - component_type_id)) { - multi_mtf_.Insert(kMtfTypeFloatScalarOrVector, inst_.result_id); - } else if (multi_mtf_.HasValue(GetMtfIdGeneratedByOpcode(SpvOpTypeInt), - component_type_id)) { - multi_mtf_.Insert(kMtfTypeIntScalarOrVector, inst_.result_id); - } else if (multi_mtf_.HasValue(GetMtfIdGeneratedByOpcode(SpvOpTypeBool), - component_type_id)) { - multi_mtf_.Insert(kMtfTypeBoolScalarOrVector, inst_.result_id); - } - multi_mtf_.Insert(GetMtfTypeVectorOfSize(size), inst_.result_id); - } - - if (inst_.opcode == SpvOpTypeFunction) { - const uint32_t return_type = inst_.words[2]; - multi_mtf_.Insert(kMtfTypeReturnedByFunction, return_type); - multi_mtf_.Insert(GetMtfFunctionTypeWithReturnType(return_type), - inst_.result_id); - } - - if (inst_.type_id) { - const val::Instruction* type_inst = FindDef(inst_.type_id); - assert(type_inst); - - multi_mtf_.Insert(kMtfObject, inst_.result_id); - - multi_mtf_.Insert(GetMtfIdOfType(inst_.type_id), inst_.result_id); - - if (multi_mtf_.HasValue(kMtfTypeFloatScalarOrVector, inst_.type_id)) { - multi_mtf_.Insert(kMtfFloatScalarOrVector, inst_.result_id); - } - - if (multi_mtf_.HasValue(kMtfTypeIntScalarOrVector, inst_.type_id)) - multi_mtf_.Insert(kMtfIntScalarOrVector, inst_.result_id); - - if (multi_mtf_.HasValue(kMtfTypeBoolScalarOrVector, inst_.type_id)) - multi_mtf_.Insert(kMtfBoolScalarOrVector, inst_.result_id); - - if (multi_mtf_.HasValue(kMtfTypeComposite, inst_.type_id)) - multi_mtf_.Insert(kMtfComposite, inst_.result_id); - - switch (type_inst->opcode()) { - case SpvOpTypeInt: - case SpvOpTypeBool: - case SpvOpTypePointer: - case SpvOpTypeVector: - case SpvOpTypeImage: - case SpvOpTypeSampledImage: - case SpvOpTypeSampler: - multi_mtf_.Insert( - GetMtfIdWithTypeGeneratedByOpcode(type_inst->opcode()), - inst_.result_id); - break; - default: - break; - } - - if (type_inst->opcode() == SpvOpTypeVector) { - const uint32_t component_type = type_inst->word(2); - multi_mtf_.Insert(GetMtfVectorOfComponentType(component_type), - inst_.result_id); - } - - if (type_inst->opcode() == SpvOpTypePointer) { - assert(type_inst->operands().size() > 2); - assert(type_inst->words().size() > type_inst->operands()[2].offset); - const uint32_t data_type = - type_inst->word(type_inst->operands()[2].offset); - multi_mtf_.Insert(GetMtfPointerToType(data_type), inst_.result_id); - - if (multi_mtf_.HasValue(kMtfTypeComposite, data_type)) - multi_mtf_.Insert(kMtfTypePointerToComposite, inst_.result_id); - } - } - - if (spvOpcodeGeneratesType(opcode)) { - if (opcode != SpvOpTypeFunction) { - multi_mtf_.Insert(kMtfTypeNonFunction, inst_.result_id); - } - } - } - - if (model_->AnyDescriptorHasCodingScheme()) { - const uint32_t long_descriptor = - long_id_descriptors_.ProcessInstruction(inst_); - if (model_->DescriptorHasCodingScheme(long_descriptor)) - multi_mtf_.Insert(GetMtfLongIdDescriptor(long_descriptor), - inst_.result_id); - } - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - const uint32_t short_descriptor = - short_id_descriptors_.ProcessInstruction(inst_); - multi_mtf_.Insert(GetMtfShortIdDescriptor(short_descriptor), - inst_.result_id); - } -} - -uint64_t MarkvCodec::GetRuleBasedMtf() { - // This function is only called for id operands (but not result ids). - assert(spvIsIdType(operand_.type) || - operand_.type == SPV_OPERAND_TYPE_OPTIONAL_ID); - assert(operand_.type != SPV_OPERAND_TYPE_RESULT_ID); - - const SpvOp opcode = static_cast(inst_.opcode); - - // All operand slots which expect label id. - if ((inst_.opcode == SpvOpLoopMerge && operand_index_ <= 1) || - (inst_.opcode == SpvOpSelectionMerge && operand_index_ == 0) || - (inst_.opcode == SpvOpBranch && operand_index_ == 0) || - (inst_.opcode == SpvOpBranchConditional && - (operand_index_ == 1 || operand_index_ == 2)) || - (inst_.opcode == SpvOpPhi && operand_index_ >= 3 && - operand_index_ % 2 == 1) || - (inst_.opcode == SpvOpSwitch && operand_index_ > 0)) { - return kMtfLabel; - } - - switch (opcode) { - case SpvOpFAdd: - case SpvOpFSub: - case SpvOpFMul: - case SpvOpFDiv: - case SpvOpFRem: - case SpvOpFMod: - case SpvOpFNegate: { - if (operand_index_ == 0) return kMtfTypeFloatScalarOrVector; - return GetMtfIdOfType(inst_.type_id); - } - - case SpvOpISub: - case SpvOpIAdd: - case SpvOpIMul: - case SpvOpSDiv: - case SpvOpUDiv: - case SpvOpSMod: - case SpvOpUMod: - case SpvOpSRem: - case SpvOpSNegate: { - if (operand_index_ == 0) return kMtfTypeIntScalarOrVector; - - return kMtfIntScalarOrVector; - } - - // TODO(atgoo@github.com) Add OpConvertFToU and other opcodes. - - case SpvOpFOrdEqual: - case SpvOpFUnordEqual: - case SpvOpFOrdNotEqual: - case SpvOpFUnordNotEqual: - case SpvOpFOrdLessThan: - case SpvOpFUnordLessThan: - case SpvOpFOrdGreaterThan: - case SpvOpFUnordGreaterThan: - case SpvOpFOrdLessThanEqual: - case SpvOpFUnordLessThanEqual: - case SpvOpFOrdGreaterThanEqual: - case SpvOpFUnordGreaterThanEqual: { - if (operand_index_ == 0) return kMtfTypeBoolScalarOrVector; - if (operand_index_ == 2) return kMtfFloatScalarOrVector; - if (operand_index_ == 3) { - const uint32_t first_operand_id = GetInstWords()[3]; - const uint32_t first_operand_type = id_to_type_id_.at(first_operand_id); - return GetMtfIdOfType(first_operand_type); - } - break; - } - - case SpvOpVectorShuffle: { - if (operand_index_ == 0) { - assert(inst_.num_operands > 4); - return GetMtfTypeVectorOfSize(inst_.num_operands - 4); - } - - assert(inst_.type_id); - if (operand_index_ == 2 || operand_index_ == 3) - return GetMtfVectorOfComponentType( - GetVectorComponentType(inst_.type_id)); - break; - } - - case SpvOpVectorTimesScalar: { - if (operand_index_ == 0) { - // TODO(atgoo@github.com) Could be narrowed to vector of floats. - return GetMtfIdGeneratedByOpcode(SpvOpTypeVector); - } - - assert(inst_.type_id); - if (operand_index_ == 2) return GetMtfIdOfType(inst_.type_id); - if (operand_index_ == 3) - return GetMtfIdOfType(GetVectorComponentType(inst_.type_id)); - break; - } - - case SpvOpDot: { - if (operand_index_ == 0) return GetMtfIdGeneratedByOpcode(SpvOpTypeFloat); - - assert(inst_.type_id); - if (operand_index_ == 2) - return GetMtfVectorOfComponentType(inst_.type_id); - if (operand_index_ == 3) { - const uint32_t vector_id = GetInstWords()[3]; - const uint32_t vector_type = id_to_type_id_.at(vector_id); - return GetMtfIdOfType(vector_type); - } - break; - } - - case SpvOpTypeVector: { - if (operand_index_ == 1) { - return kMtfTypeScalar; - } - break; - } - - case SpvOpTypeMatrix: { - if (operand_index_ == 1) { - return GetMtfIdGeneratedByOpcode(SpvOpTypeVector); - } - break; - } - - case SpvOpTypePointer: { - if (operand_index_ == 2) { - return kMtfTypeNonFunction; - } - break; - } - - case SpvOpTypeStruct: { - if (operand_index_ >= 1) { - return kMtfTypeNonFunction; - } - break; - } - - case SpvOpTypeFunction: { - if (operand_index_ == 1) { - return kMtfTypeNonFunction; - } - - if (operand_index_ >= 2) { - return kMtfTypeNonFunction; - } - break; - } - - case SpvOpLoad: { - if (operand_index_ == 0) return kMtfTypeNonFunction; - - if (operand_index_ == 2) { - assert(inst_.type_id); - return GetMtfPointerToType(inst_.type_id); - } - break; - } - - case SpvOpStore: { - if (operand_index_ == 0) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypePointer); - if (operand_index_ == 1) { - const uint32_t pointer_id = GetInstWords()[1]; - const uint32_t pointer_type = id_to_type_id_.at(pointer_id); - const val::Instruction* pointer_inst = FindDef(pointer_type); - assert(pointer_inst); - assert(pointer_inst->opcode() == SpvOpTypePointer); - const uint32_t data_type = - pointer_inst->word(pointer_inst->operands()[2].offset); - return GetMtfIdOfType(data_type); - } - break; - } - - case SpvOpVariable: { - if (operand_index_ == 0) - return GetMtfIdGeneratedByOpcode(SpvOpTypePointer); - break; - } - - case SpvOpAccessChain: { - if (operand_index_ == 0) - return GetMtfIdGeneratedByOpcode(SpvOpTypePointer); - if (operand_index_ == 2) return kMtfTypePointerToComposite; - if (operand_index_ >= 3) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeInt); - break; - } - - case SpvOpCompositeConstruct: { - if (operand_index_ == 0) return kMtfTypeComposite; - if (operand_index_ >= 2) { - const uint32_t composite_type = GetInstWords()[1]; - if (multi_mtf_.HasValue(kMtfTypeFloatScalarOrVector, composite_type)) - return kMtfFloatScalarOrVector; - if (multi_mtf_.HasValue(kMtfTypeIntScalarOrVector, composite_type)) - return kMtfIntScalarOrVector; - if (multi_mtf_.HasValue(kMtfTypeBoolScalarOrVector, composite_type)) - return kMtfBoolScalarOrVector; - } - break; - } - - case SpvOpCompositeExtract: { - if (operand_index_ == 2) return kMtfComposite; - break; - } - - case SpvOpConstantComposite: { - if (operand_index_ == 0) return kMtfTypeComposite; - if (operand_index_ >= 2) { - const val::Instruction* composite_type_inst = FindDef(inst_.type_id); - assert(composite_type_inst); - if (composite_type_inst->opcode() == SpvOpTypeVector) { - return GetMtfIdOfType(composite_type_inst->word(2)); - } - } - break; - } - - case SpvOpExtInst: { - if (operand_index_ == 2) - return GetMtfIdGeneratedByOpcode(SpvOpExtInstImport); - if (operand_index_ >= 4) { - const uint32_t return_type = GetInstWords()[1]; - const uint32_t ext_inst_type = inst_.ext_inst_type; - const uint32_t ext_inst_index = GetInstWords()[4]; - // TODO(atgoo@github.com) The list of extended instructions is - // incomplete. Only common instructions and low-hanging fruits listed. - if (ext_inst_type == SPV_EXT_INST_TYPE_GLSL_STD_450) { - switch (ext_inst_index) { - case GLSLstd450FAbs: - case GLSLstd450FClamp: - case GLSLstd450FMax: - case GLSLstd450FMin: - case GLSLstd450FMix: - case GLSLstd450Step: - case GLSLstd450SmoothStep: - case GLSLstd450Fma: - case GLSLstd450Pow: - case GLSLstd450Exp: - case GLSLstd450Exp2: - case GLSLstd450Log: - case GLSLstd450Log2: - case GLSLstd450Sqrt: - case GLSLstd450InverseSqrt: - case GLSLstd450Fract: - case GLSLstd450Floor: - case GLSLstd450Ceil: - case GLSLstd450Radians: - case GLSLstd450Degrees: - case GLSLstd450Sin: - case GLSLstd450Cos: - case GLSLstd450Tan: - case GLSLstd450Sinh: - case GLSLstd450Cosh: - case GLSLstd450Tanh: - case GLSLstd450Asin: - case GLSLstd450Acos: - case GLSLstd450Atan: - case GLSLstd450Atan2: - case GLSLstd450Asinh: - case GLSLstd450Acosh: - case GLSLstd450Atanh: - case GLSLstd450MatrixInverse: - case GLSLstd450Cross: - case GLSLstd450Normalize: - case GLSLstd450Reflect: - case GLSLstd450FaceForward: - return GetMtfIdOfType(return_type); - case GLSLstd450Length: - case GLSLstd450Distance: - case GLSLstd450Refract: - return kMtfFloatScalarOrVector; - default: - break; - } - } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_STD) { - switch (ext_inst_index) { - case OpenCLLIB::Fabs: - case OpenCLLIB::FClamp: - case OpenCLLIB::Fmax: - case OpenCLLIB::Fmin: - case OpenCLLIB::Step: - case OpenCLLIB::Smoothstep: - case OpenCLLIB::Fma: - case OpenCLLIB::Pow: - case OpenCLLIB::Exp: - case OpenCLLIB::Exp2: - case OpenCLLIB::Log: - case OpenCLLIB::Log2: - case OpenCLLIB::Sqrt: - case OpenCLLIB::Rsqrt: - case OpenCLLIB::Fract: - case OpenCLLIB::Floor: - case OpenCLLIB::Ceil: - case OpenCLLIB::Radians: - case OpenCLLIB::Degrees: - case OpenCLLIB::Sin: - case OpenCLLIB::Cos: - case OpenCLLIB::Tan: - case OpenCLLIB::Sinh: - case OpenCLLIB::Cosh: - case OpenCLLIB::Tanh: - case OpenCLLIB::Asin: - case OpenCLLIB::Acos: - case OpenCLLIB::Atan: - case OpenCLLIB::Atan2: - case OpenCLLIB::Asinh: - case OpenCLLIB::Acosh: - case OpenCLLIB::Atanh: - case OpenCLLIB::Cross: - case OpenCLLIB::Normalize: - return GetMtfIdOfType(return_type); - case OpenCLLIB::Length: - case OpenCLLIB::Distance: - return kMtfFloatScalarOrVector; - default: - break; - } - } - } - break; - } - - case SpvOpFunction: { - if (operand_index_ == 0) return kMtfTypeReturnedByFunction; - - if (operand_index_ == 3) { - const uint32_t return_type = GetInstWords()[1]; - return GetMtfFunctionTypeWithReturnType(return_type); - } - break; - } - - case SpvOpFunctionCall: { - if (operand_index_ == 0) return kMtfTypeReturnedByFunction; - - if (operand_index_ == 2) { - const uint32_t return_type = GetInstWords()[1]; - return GetMtfFunctionWithReturnType(return_type); - } - - if (operand_index_ >= 3) { - const uint32_t function_id = GetInstWords()[3]; - const val::Instruction* function_inst = FindDef(function_id); - if (!function_inst) return kMtfObject; - - assert(function_inst->opcode() == SpvOpFunction); - - const uint32_t function_type_id = function_inst->word(4); - const val::Instruction* function_type_inst = FindDef(function_type_id); - assert(function_type_inst); - assert(function_type_inst->opcode() == SpvOpTypeFunction); - - const uint32_t argument_type = function_type_inst->word(operand_index_); - return GetMtfIdOfType(argument_type); - } - break; - } - - case SpvOpReturnValue: { - if (operand_index_ == 0) return GetMtfIdOfType(cur_function_return_type_); - break; - } - - case SpvOpBranchConditional: { - if (operand_index_ == 0) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeBool); - break; - } - - case SpvOpSampledImage: { - if (operand_index_ == 0) - return GetMtfIdGeneratedByOpcode(SpvOpTypeSampledImage); - if (operand_index_ == 2) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeImage); - if (operand_index_ == 3) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeSampler); - break; - } - - case SpvOpImageSampleImplicitLod: { - if (operand_index_ == 0) - return GetMtfIdGeneratedByOpcode(SpvOpTypeVector); - if (operand_index_ == 2) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeSampledImage); - if (operand_index_ == 3) - return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeVector); - break; - } - - default: - break; - } - - return kMtfNone; -} - -} // namespace comp -} // namespace spvtools diff --git a/source/comp/markv_codec.h b/source/comp/markv_codec.h deleted file mode 100644 index f313d6178..000000000 --- a/source/comp/markv_codec.h +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SOURCE_COMP_MARKV_CODEC_H_ -#define SOURCE_COMP_MARKV_CODEC_H_ - -#include -#include -#include -#include - -#include "source/assembly_grammar.h" -#include "source/comp/huffman_codec.h" -#include "source/comp/markv_model.h" -#include "source/comp/move_to_front.h" -#include "source/diagnostic.h" -#include "source/id_descriptor.h" - -#include "source/val/instruction.h" - -// Base class for MARK-V encoder and decoder. Contains common functionality -// such as: -// - Validator connection and validation state. -// - SPIR-V grammar and helper functions. - -namespace spvtools { -namespace comp { - -class MarkvLogger; - -// Handles for move-to-front sequences. Enums which end with "Begin" define -// handle spaces which start at that value and span 16 or 32 bit wide. -enum : uint64_t { - kMtfNone = 0, - // All ids. - kMtfAll, - // All forward declared ids. - kMtfForwardDeclared, - // All type ids except for generated by OpTypeFunction. - kMtfTypeNonFunction, - // All labels. - kMtfLabel, - // All ids created by instructions which had type_id. - kMtfObject, - // All types generated by OpTypeFloat, OpTypeInt, OpTypeBool. - kMtfTypeScalar, - // All composite types. - kMtfTypeComposite, - // Boolean type or any vector type of it. - kMtfTypeBoolScalarOrVector, - // All float types or any vector floats type. - kMtfTypeFloatScalarOrVector, - // All int types or any vector int type. - kMtfTypeIntScalarOrVector, - // All types declared as return types in OpTypeFunction. - kMtfTypeReturnedByFunction, - // All composite objects. - kMtfComposite, - // All bool objects or vectors of bools. - kMtfBoolScalarOrVector, - // All float objects or vectors of float. - kMtfFloatScalarOrVector, - // All int objects or vectors of int. - kMtfIntScalarOrVector, - // All pointer types which point to composited. - kMtfTypePointerToComposite, - // Used by EncodeMtfRankHuffman. - kMtfGenericNonZeroRank, - // Handle space for ids of specific type. - kMtfIdOfTypeBegin = 0x10000, - // Handle space for ids generated by specific opcode. - kMtfIdGeneratedByOpcode = 0x20000, - // Handle space for ids of objects with type generated by specific opcode. - kMtfIdWithTypeGeneratedByOpcodeBegin = 0x30000, - // All vectors of specific component type. - kMtfVectorOfComponentTypeBegin = 0x40000, - // All vector types of specific size. - kMtfTypeVectorOfSizeBegin = 0x50000, - // All pointer types to specific type. - kMtfPointerToTypeBegin = 0x60000, - // All function types which return specific type. - kMtfFunctionTypeWithReturnTypeBegin = 0x70000, - // All function objects which return specific type. - kMtfFunctionWithReturnTypeBegin = 0x80000, - // Short id descriptor space (max 16-bit). - kMtfShortIdDescriptorSpaceBegin = 0x90000, - // Long id descriptor space (32-bit). - kMtfLongIdDescriptorSpaceBegin = 0x100000000, -}; - -class MarkvCodec { - public: - static const uint32_t kMarkvMagicNumber; - - // Mtf ranks smaller than this are encoded with Huffman coding. - static const uint32_t kMtfSmallestRankEncodedByValue; - - // Signals that the mtf rank is too large to be encoded with Huffman. - static const uint32_t kMtfRankEncodedByValueSignal; - - static const uint32_t kShortDescriptorNumBits; - - static const size_t kByteBreakAfterInstIfLessThanUntilNextByte; - - static uint32_t GetMarkvVersion(); - - virtual ~MarkvCodec(); - - protected: - struct MarkvHeader { - MarkvHeader(); - - uint32_t magic_number; - uint32_t markv_version; - // Magic number to identify or verify MarkvModel used for encoding. - uint32_t markv_model = 0; - uint32_t markv_length_in_bits = 0; - uint32_t spirv_version = 0; - uint32_t spirv_generator = 0; - }; - - // |model| is owned by the caller, must be not null and valid during the - // lifetime of the codec. - MarkvCodec(spv_const_context context, spv_validator_options validator_options, - const MarkvModel* model); - - // Returns instruction which created |id| or nullptr if such instruction was - // not registered. - const val::Instruction* FindDef(uint32_t id) const { - const auto it = id_to_def_instruction_.find(id); - if (it == id_to_def_instruction_.end()) return nullptr; - return it->second; - } - - size_t GetNumBitsToNextByte(size_t bit_pos) const; - bool OpcodeHasFixedNumberOfOperands(SpvOp opcode) const; - - // Returns type id of vector type component. - uint32_t GetVectorComponentType(uint32_t vector_type_id) const { - const val::Instruction* type_inst = FindDef(vector_type_id); - assert(type_inst); - assert(type_inst->opcode() == SpvOpTypeVector); - - const uint32_t component_type = - type_inst->word(type_inst->operands()[1].offset); - return component_type; - } - - // Returns mtf handle for ids of given type. - uint64_t GetMtfIdOfType(uint32_t type_id) const { - return kMtfIdOfTypeBegin + type_id; - } - - // Returns mtf handle for ids generated by given opcode. - uint64_t GetMtfIdGeneratedByOpcode(SpvOp opcode) const { - return kMtfIdGeneratedByOpcode + opcode; - } - - // Returns mtf handle for ids of type generated by given opcode. - uint64_t GetMtfIdWithTypeGeneratedByOpcode(SpvOp opcode) const { - return kMtfIdWithTypeGeneratedByOpcodeBegin + opcode; - } - - // Returns mtf handle for vectors of specific component type. - uint64_t GetMtfVectorOfComponentType(uint32_t type_id) const { - return kMtfVectorOfComponentTypeBegin + type_id; - } - - // Returns mtf handle for vector type of specific size. - uint64_t GetMtfTypeVectorOfSize(uint32_t size) const { - return kMtfTypeVectorOfSizeBegin + size; - } - - // Returns mtf handle for pointers to specific size. - uint64_t GetMtfPointerToType(uint32_t type_id) const { - return kMtfPointerToTypeBegin + type_id; - } - - // Returns mtf handle for function types with given return type. - uint64_t GetMtfFunctionTypeWithReturnType(uint32_t type_id) const { - return kMtfFunctionTypeWithReturnTypeBegin + type_id; - } - - // Returns mtf handle for functions with given return type. - uint64_t GetMtfFunctionWithReturnType(uint32_t type_id) const { - return kMtfFunctionWithReturnTypeBegin + type_id; - } - - // Returns mtf handle for the given long id descriptor. - uint64_t GetMtfLongIdDescriptor(uint32_t descriptor) const { - return kMtfLongIdDescriptorSpaceBegin + descriptor; - } - - // Returns mtf handle for the given short id descriptor. - uint64_t GetMtfShortIdDescriptor(uint32_t descriptor) const { - return kMtfShortIdDescriptorSpaceBegin + descriptor; - } - - // Process data from the current instruction. This would update MTFs and - // other data containers. - void ProcessCurInstruction(); - - // Returns move-to-front handle to be used for the current operand slot. - // Mtf handle is chosen based on a set of rules defined by SPIR-V grammar. - uint64_t GetRuleBasedMtf(); - - // Returns words of the current instruction. Decoder has a different - // implementation and the array is valid only until the previously decoded - // word. - virtual const uint32_t* GetInstWords() const { return inst_.words; } - - // Returns the opcode of the previous instruction. - SpvOp GetPrevOpcode() const { - if (instructions_.empty()) return SpvOpNop; - - return instructions_.back()->opcode(); - } - - // Returns diagnostic stream, position index is set to instruction number. - DiagnosticStream Diag(spv_result_t error_code) const { - return DiagnosticStream({0, 0, instructions_.size()}, context_->consumer, - "", error_code); - } - - // Returns current id bound. - uint32_t GetIdBound() const { return id_bound_; } - - // Sets current id bound, expected to be no lower than the previous one. - void SetIdBound(uint32_t id_bound) { - assert(id_bound >= id_bound_); - id_bound_ = id_bound; - } - - // Returns Huffman codec for ranks of the mtf with given |handle|. - // Different mtfs can use different rank distributions. - // May return nullptr if the codec doesn't exist. - const HuffmanCodec* GetMtfHuffmanCodec(uint64_t handle) const { - const auto it = mtf_huffman_codecs_.find(handle); - if (it == mtf_huffman_codecs_.end()) return nullptr; - return it->second.get(); - } - - // Promotes id in all move-to-front sequences if ids can be shared by multiple - // sequences. - void PromoteIfNeeded(uint32_t id) { - if (!model_->AnyDescriptorHasCodingScheme() && - model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - // Move-to-front sequences do not share ids. Nothing to do. - return; - } - multi_mtf_.Promote(id); - } - - spv_validator_options validator_options_ = nullptr; - const AssemblyGrammar grammar_; - MarkvHeader header_; - - // MARK-V model, not owned. - const MarkvModel* model_ = nullptr; - - // Current instruction, current operand and current operand index. - spv_parsed_instruction_t inst_; - spv_parsed_operand_t operand_; - uint32_t operand_index_; - - // Maps a result ID to its type ID. By convention: - // - a result ID that is a type definition maps to itself. - // - a result ID without a type maps to 0. (E.g. for OpLabel) - std::unordered_map id_to_type_id_; - - // Container for all move-to-front sequences. - MultiMoveToFront multi_mtf_; - - // Id of the current function or zero if outside of function. - uint32_t cur_function_id_ = 0; - - // Return type of the current function. - uint32_t cur_function_return_type_ = 0; - - // Remaining function parameter types. This container is filled on OpFunction, - // and drained on OpFunctionParameter. - std::list remaining_function_parameter_types_; - - // List of ids local to the current function. - std::vector ids_local_to_cur_function_; - - // List of instructions in the order they are given in the module. - std::vector> instructions_; - - // Container/computer for long (32-bit) id descriptors. - IdDescriptorCollection long_id_descriptors_; - - // Container/computer for short id descriptors. - // Short descriptors are stored in uint32_t, but their actual bit width is - // defined with kShortDescriptorNumBits. - // It doesn't seem logical to have a different computer for short id - // descriptors, since one could actually map/truncate long descriptors. - // But as short descriptors have collisions, the efficiency of - // compression depends on the collision pattern, and short descriptors - // produced by function ShortHashU32Array have been empirically proven to - // produce better results. - IdDescriptorCollection short_id_descriptors_; - - // Huffman codecs for move-to-front ranks. The map key is mtf handle. Doesn't - // need to contain a different codec for every handle as most use one and the - // same. - std::map>> - mtf_huffman_codecs_; - - // If not nullptr, codec will log comments on the compression process. - std::unique_ptr logger_; - - spv_const_context context_ = nullptr; - - private: - // Maps result id to the instruction which defined it. - std::unordered_map id_to_def_instruction_; - - uint32_t id_bound_ = 1; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MARKV_CODEC_H_ diff --git a/source/comp/markv_decoder.cpp b/source/comp/markv_decoder.cpp deleted file mode 100644 index 22115831d..000000000 --- a/source/comp/markv_decoder.cpp +++ /dev/null @@ -1,925 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/comp/markv_decoder.h" - -#include -#include -#include - -#include "source/ext_inst.h" -#include "source/opcode.h" -#include "spirv-tools/libspirv.hpp" - -namespace spvtools { -namespace comp { - -spv_result_t MarkvDecoder::DecodeNonIdWord(uint32_t* word) { - auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); - - if (codec) { - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to decode non-id word with Huffman"; - - if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { - // The word decoded successfully. - *word = uint32_t(decoded_value); - assert(*word == decoded_value); - return SPV_SUCCESS; - } - - // Received kMarkvNoneOfTheAbove signal, use fallback decoding. - } - - const size_t chunk_length = - model_->GetOperandVariableWidthChunkLength(operand_.type); - if (chunk_length) { - if (!reader_.ReadVariableWidthU32(word, chunk_length)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to decode non-id word with varint"; - } else { - if (!reader_.ReadUnencoded(word)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read unencoded non-id word"; - } - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeOpcodeAndNumberOfOperands( - uint32_t* opcode, uint32_t* num_operands) { - // First try to use the Markov chain codec. - auto* codec = - model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); - if (codec) { - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode opcode_and_num_operands, previous opcode is " - << spvOpcodeString(GetPrevOpcode()); - - if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { - // The word was successfully decoded. - *opcode = uint32_t(decoded_value & 0xFFFF); - *num_operands = uint32_t(decoded_value >> 16); - return SPV_SUCCESS; - } - - // Received kMarkvNoneOfTheAbove signal, use fallback decoding. - } - - // Fallback to base-rate codec. - codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); - assert(codec); - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode opcode_and_num_operands with global codec"; - - if (decoded_value == MarkvModel::GetMarkvNoneOfTheAbove()) { - // Received kMarkvNoneOfTheAbove signal, fallback further. - return SPV_UNSUPPORTED; - } - - *opcode = uint32_t(decoded_value & 0xFFFF); - *num_operands = uint32_t(decoded_value >> 16); - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeMtfRankHuffman(uint64_t mtf, - uint32_t fallback_method, - uint32_t* rank) { - const auto* codec = GetMtfHuffmanCodec(mtf); - if (!codec) { - assert(fallback_method != kMtfNone); - codec = GetMtfHuffmanCodec(fallback_method); - } - - if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to decode MTF rank"; - - uint32_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) << "Failed to decode MTF rank with Huffman"; - - if (decoded_value == kMtfRankEncodedByValueSignal) { - // Decode by value. - if (!reader_.ReadVariableWidthU32(rank, model_->mtf_rank_chunk_length())) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode MTF rank with varint"; - *rank += MarkvCodec::kMtfSmallestRankEncodedByValue; - } else { - // Decode using Huffman coding. - assert(decoded_value < MarkvCodec::kMtfSmallestRankEncodedByValue); - *rank = decoded_value; - } - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeIdWithDescriptor(uint32_t* id) { - auto* codec = - model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); - - uint64_t mtf = kMtfNone; - if (codec) { - uint64_t decoded_value = 0; - if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode descriptor with Huffman"; - - if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { - const uint32_t long_descriptor = uint32_t(decoded_value); - mtf = GetMtfLongIdDescriptor(long_descriptor); - } - } - - if (mtf == kMtfNone) { - if (model_->id_fallback_strategy() != - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - return SPV_UNSUPPORTED; - } - - uint64_t decoded_value = 0; - if (!reader_.ReadBits(&decoded_value, MarkvCodec::kShortDescriptorNumBits)) - return Diag(SPV_ERROR_INTERNAL) << "Failed to read short descriptor"; - const uint32_t short_descriptor = uint32_t(decoded_value); - if (short_descriptor == 0) { - // Forward declared id. - return SPV_UNSUPPORTED; - } - mtf = GetMtfShortIdDescriptor(short_descriptor); - } - - return DecodeExistingId(mtf, id); -} - -spv_result_t MarkvDecoder::DecodeExistingId(uint64_t mtf, uint32_t* id) { - assert(multi_mtf_.GetSize(mtf) > 0); - *id = 0; - - uint32_t rank = 0; - - if (multi_mtf_.GetSize(mtf) == 1) { - rank = 1; - } else { - const spv_result_t result = - DecodeMtfRankHuffman(mtf, kMtfGenericNonZeroRank, &rank); - if (result != SPV_SUCCESS) return result; - } - - assert(rank); - if (!multi_mtf_.ValueFromRank(mtf, rank, id)) - return Diag(SPV_ERROR_INTERNAL) << "MTF rank is out of bounds"; - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeRefId(uint32_t* id) { - { - const spv_result_t result = DecodeIdWithDescriptor(id); - if (result != SPV_UNSUPPORTED) return result; - } - - const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( - SpvOp(inst_.opcode))(operand_index_); - uint32_t rank = 0; - *id = 0; - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - uint64_t mtf = GetRuleBasedMtf(); - if (mtf != kMtfNone && !can_forward_declare) { - return DecodeExistingId(mtf, id); - } - - if (mtf == kMtfNone) mtf = kMtfAll; - { - const spv_result_t result = DecodeMtfRankHuffman(mtf, kMtfAll, &rank); - if (result != SPV_SUCCESS) return result; - } - - if (rank == 0) { - // This is the first occurrence of a forward declared id. - *id = GetIdBound(); - SetIdBound(*id + 1); - multi_mtf_.Insert(kMtfAll, *id); - multi_mtf_.Insert(kMtfForwardDeclared, *id); - if (mtf != kMtfAll) multi_mtf_.Insert(mtf, *id); - } else { - if (!multi_mtf_.ValueFromRank(mtf, rank, id)) - return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; - } - } else { - assert(can_forward_declare); - - if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to decode MTF rank with varint"; - - if (rank == 0) { - // This is the first occurrence of a forward declared id. - *id = GetIdBound(); - SetIdBound(*id + 1); - multi_mtf_.Insert(kMtfForwardDeclared, *id); - } else { - if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, id)) - return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; - } - } - assert(*id); - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeTypeId() { - if (inst_.opcode == SpvOpFunctionParameter) { - assert(!remaining_function_parameter_types_.empty()); - inst_.type_id = remaining_function_parameter_types_.front(); - remaining_function_parameter_types_.pop_front(); - return SPV_SUCCESS; - } - - { - const spv_result_t result = DecodeIdWithDescriptor(&inst_.type_id); - if (result != SPV_UNSUPPORTED) return result; - } - - assert(model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased); - - uint64_t mtf = GetRuleBasedMtf(); - assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( - operand_index_)); - - if (mtf == kMtfNone) { - mtf = kMtfTypeNonFunction; - // Function types should have been handled by GetRuleBasedMtf. - assert(inst_.opcode != SpvOpFunction); - } - - return DecodeExistingId(mtf, &inst_.type_id); -} - -spv_result_t MarkvDecoder::DecodeResultId() { - uint32_t rank = 0; - - const uint64_t num_still_forward_declared = - multi_mtf_.GetSize(kMtfForwardDeclared); - - if (num_still_forward_declared) { - // Some ids were forward declared. Check if this id is one of them. - uint64_t id_was_forward_declared; - if (!reader_.ReadBits(&id_was_forward_declared, 1)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read id_was_forward_declared flag"; - - if (id_was_forward_declared) { - if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read MTF rank of forward declared id"; - - if (rank) { - // The id was forward declared, recover it from kMtfForwardDeclared. - if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, - &inst_.result_id)) - return Diag(SPV_ERROR_INTERNAL) - << "Forward declared MTF rank is out of bounds"; - - // We can now remove the id from kMtfForwardDeclared. - if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to remove id from kMtfForwardDeclared"; - } - } - } - - if (inst_.result_id == 0) { - // The id was not forward declared, issue a new id. - inst_.result_id = GetIdBound(); - SetIdBound(inst_.result_id + 1); - } - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - if (!rank) { - multi_mtf_.Insert(kMtfAll, inst_.result_id); - } - } - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeLiteralNumber( - const spv_parsed_operand_t& operand) { - if (operand.number_bit_width <= 32) { - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - inst_words_.push_back(word); - } else { - assert(operand.number_bit_width <= 64); - uint64_t word = 0; - if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { - if (!reader_.ReadVariableWidthU64(&word, model_->u64_chunk_length())) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal U64"; - } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { - int64_t val = 0; - if (!reader_.ReadVariableWidthS64(&val, model_->s64_chunk_length(), - model_->s64_block_exponent())) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal S64"; - std::memcpy(&word, &val, 8); - } else if (operand.number_kind == SPV_NUMBER_FLOATING) { - if (!reader_.ReadUnencoded(&word)) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal F64"; - } else { - return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; - } - inst_words_.push_back(static_cast(word)); - inst_words_.push_back(static_cast(word >> 32)); - } - return SPV_SUCCESS; -} - -bool MarkvDecoder::ReadToByteBreak(size_t byte_break_if_less_than) { - const size_t num_bits_to_next_byte = - GetNumBitsToNextByte(reader_.GetNumReadBits()); - if (num_bits_to_next_byte == 0 || - num_bits_to_next_byte > byte_break_if_less_than) - return true; - - uint64_t bits = 0; - if (!reader_.ReadBits(&bits, num_bits_to_next_byte)) return false; - - assert(bits == 0); - if (bits != 0) return false; - - return true; -} - -spv_result_t MarkvDecoder::DecodeModule(std::vector* spirv_binary) { - const bool header_read_success = - reader_.ReadUnencoded(&header_.magic_number) && - reader_.ReadUnencoded(&header_.markv_version) && - reader_.ReadUnencoded(&header_.markv_model) && - reader_.ReadUnencoded(&header_.markv_length_in_bits) && - reader_.ReadUnencoded(&header_.spirv_version) && - reader_.ReadUnencoded(&header_.spirv_generator); - - if (!header_read_success) - return Diag(SPV_ERROR_INVALID_BINARY) << "Unable to read MARK-V header"; - - if (header_.markv_length_in_bits == 0) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Header markv_length_in_bits field is zero"; - - if (header_.magic_number != MarkvCodec::kMarkvMagicNumber) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary has incorrect magic number"; - - // TODO(atgoo@github.com): Print version strings. - if (header_.markv_version != MarkvCodec::GetMarkvVersion()) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary and the codec have different versions"; - - const uint32_t model_type = header_.markv_model >> 16; - const uint32_t model_version = header_.markv_model & 0xFFFF; - if (model_type != model_->model_type()) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary and the codec use different MARK-V models"; - - if (model_version != model_->model_version()) - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary and the codec use different versions if the same " - << "MARK-V model"; - - spirv_.reserve(header_.markv_length_in_bits / 2); // Heuristic. - spirv_.resize(5, 0); - spirv_[0] = SpvMagicNumber; - spirv_[1] = header_.spirv_version; - spirv_[2] = header_.spirv_generator; - - if (logger_) { - reader_.SetCallback( - [this](const std::string& str) { logger_->AppendBitSequence(str); }); - } - - while (reader_.GetNumReadBits() < header_.markv_length_in_bits) { - inst_ = {}; - const spv_result_t decode_result = DecodeInstruction(); - if (decode_result != SPV_SUCCESS) return decode_result; - } - - if (validator_options_) { - spv_const_binary_t validation_binary = {spirv_.data(), spirv_.size()}; - const spv_result_t result = spvValidateWithOptions( - context_, validator_options_, &validation_binary, nullptr); - if (result != SPV_SUCCESS) return result; - } - - // Validate the decode binary - if (reader_.GetNumReadBits() != header_.markv_length_in_bits || - !reader_.OnlyZeroesLeft()) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "MARK-V binary has wrong stated bit length " - << reader_.GetNumReadBits() << " " << header_.markv_length_in_bits; - } - - // Decoding of the module is finished, validation state should have correct - // id bound. - spirv_[3] = GetIdBound(); - - *spirv_binary = std::move(spirv_); - return SPV_SUCCESS; -} - -// TODO(atgoo@github.com): The implementation borrows heavily from -// Parser::parseOperand. -// Consider coupling them together in some way once MARK-V codec is more mature. -// For now it's better to keep the code independent for experimentation -// purposes. -spv_result_t MarkvDecoder::DecodeOperand( - size_t operand_offset, const spv_operand_type_t type, - spv_operand_pattern_t* expected_operands) { - const SpvOp opcode = static_cast(inst_.opcode); - - memset(&operand_, 0, sizeof(operand_)); - - assert((operand_offset >> 16) == 0); - operand_.offset = static_cast(operand_offset); - operand_.type = type; - - // Set default values, may be updated later. - operand_.number_kind = SPV_NUMBER_NONE; - operand_.number_bit_width = 0; - - const size_t first_word_index = inst_words_.size(); - - switch (type) { - case SPV_OPERAND_TYPE_RESULT_ID: { - const spv_result_t result = DecodeResultId(); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(inst_.result_id); - SetIdBound(std::max(GetIdBound(), inst_.result_id + 1)); - PromoteIfNeeded(inst_.result_id); - break; - } - - case SPV_OPERAND_TYPE_TYPE_ID: { - const spv_result_t result = DecodeTypeId(); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(inst_.type_id); - SetIdBound(std::max(GetIdBound(), inst_.type_id + 1)); - PromoteIfNeeded(inst_.type_id); - break; - } - - case SPV_OPERAND_TYPE_ID: - case SPV_OPERAND_TYPE_OPTIONAL_ID: - case SPV_OPERAND_TYPE_SCOPE_ID: - case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { - uint32_t id = 0; - const spv_result_t result = DecodeRefId(&id); - if (result != SPV_SUCCESS) return result; - - if (id == 0) return Diag(SPV_ERROR_INVALID_BINARY) << "Decoded id is 0"; - - if (type == SPV_OPERAND_TYPE_ID || type == SPV_OPERAND_TYPE_OPTIONAL_ID) { - operand_.type = SPV_OPERAND_TYPE_ID; - - if (opcode == SpvOpExtInst && operand_.offset == 3) { - // The current word is the extended instruction set id. - // Set the extended instruction set type for the current - // instruction. - auto ext_inst_type_iter = import_id_to_ext_inst_type_.find(id); - if (ext_inst_type_iter == import_id_to_ext_inst_type_.end()) { - return Diag(SPV_ERROR_INVALID_ID) - << "OpExtInst set id " << id - << " does not reference an OpExtInstImport result Id"; - } - inst_.ext_inst_type = ext_inst_type_iter->second; - } - } - - inst_words_.push_back(id); - SetIdBound(std::max(GetIdBound(), id + 1)); - PromoteIfNeeded(id); - break; - } - - case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - - assert(SpvOpExtInst == opcode); - assert(inst_.ext_inst_type != SPV_EXT_INST_TYPE_NONE); - spv_ext_inst_desc ext_inst; - if (grammar_.lookupExtInst(inst_.ext_inst_type, word, &ext_inst)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid extended instruction number: " << word; - spvPushOperandTypes(ext_inst->operandTypes, expected_operands); - break; - } - - case SPV_OPERAND_TYPE_LITERAL_INTEGER: - case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: { - // These are regular single-word literal integer operands. - // Post-parsing validation should check the range of the parsed value. - operand_.type = SPV_OPERAND_TYPE_LITERAL_INTEGER; - // It turns out they are always unsigned integers! - operand_.number_kind = SPV_NUMBER_UNSIGNED_INT; - operand_.number_bit_width = 32; - - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - break; - } - - case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: - case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: { - operand_.type = SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER; - if (opcode == SpvOpSwitch) { - // The literal operands have the same type as the value - // referenced by the selector Id. - const uint32_t selector_id = inst_words_.at(1); - const auto type_id_iter = id_to_type_id_.find(selector_id); - if (type_id_iter == id_to_type_id_.end() || type_id_iter->second == 0) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid OpSwitch: selector id " << selector_id - << " has no type"; - } - uint32_t type_id = type_id_iter->second; - - if (selector_id == type_id) { - // Recall that by convention, a result ID that is a type definition - // maps to itself. - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid OpSwitch: selector id " << selector_id - << " is a type, not a value"; - } - if (auto error = SetNumericTypeInfoForType(&operand_, type_id)) - return error; - if (operand_.number_kind != SPV_NUMBER_UNSIGNED_INT && - operand_.number_kind != SPV_NUMBER_SIGNED_INT) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid OpSwitch: selector id " << selector_id - << " is not a scalar integer"; - } - } else { - assert(opcode == SpvOpConstant || opcode == SpvOpSpecConstant); - // The literal number type is determined by the type Id for the - // constant. - assert(inst_.type_id); - if (auto error = SetNumericTypeInfoForType(&operand_, inst_.type_id)) - return error; - } - - if (auto error = DecodeLiteralNumber(operand_)) return error; - - break; - } - - case SPV_OPERAND_TYPE_LITERAL_STRING: - case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { - operand_.type = SPV_OPERAND_TYPE_LITERAL_STRING; - std::vector str; - auto* codec = model_->GetLiteralStringHuffmanCodec(inst_.opcode); - - if (codec) { - std::string decoded_string; - const bool huffman_result = - codec->DecodeFromStream(GetReadBitCallback(), &decoded_string); - assert(huffman_result); - if (!huffman_result) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read literal string"; - - if (decoded_string != "kMarkvNoneOfTheAbove") { - std::copy(decoded_string.begin(), decoded_string.end(), - std::back_inserter(str)); - str.push_back('\0'); - } - } - - // The loop is expected to terminate once we encounter '\0' or exhaust - // the bit stream. - if (str.empty()) { - while (true) { - char ch = 0; - if (!reader_.ReadUnencoded(&ch)) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read literal string"; - - str.push_back(ch); - - if (ch == '\0') break; - } - } - - while (str.size() % 4 != 0) str.push_back('\0'); - - inst_words_.resize(inst_words_.size() + str.size() / 4); - std::memcpy(&inst_words_[first_word_index], str.data(), str.size()); - - if (SpvOpExtInstImport == opcode) { - // Record the extended instruction type for the ID for this import. - // There is only one string literal argument to OpExtInstImport, - // so it's sufficient to guard this just on the opcode. - const spv_ext_inst_type_t ext_inst_type = - spvExtInstImportTypeGet(str.data()); - if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid extended instruction import '" << str.data() - << "'"; - } - // We must have parsed a valid result ID. It's a condition - // of the grammar, and we only accept non-zero result Ids. - assert(inst_.result_id); - const bool inserted = - import_id_to_ext_inst_type_.emplace(inst_.result_id, ext_inst_type) - .second; - (void)inserted; - assert(inserted); - } - break; - } - - case SPV_OPERAND_TYPE_CAPABILITY: - case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: - case SPV_OPERAND_TYPE_EXECUTION_MODEL: - case SPV_OPERAND_TYPE_ADDRESSING_MODEL: - case SPV_OPERAND_TYPE_MEMORY_MODEL: - case SPV_OPERAND_TYPE_EXECUTION_MODE: - case SPV_OPERAND_TYPE_STORAGE_CLASS: - case SPV_OPERAND_TYPE_DIMENSIONALITY: - case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: - case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: - case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: - case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: - case SPV_OPERAND_TYPE_LINKAGE_TYPE: - case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: - case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: - case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: - case SPV_OPERAND_TYPE_DECORATION: - case SPV_OPERAND_TYPE_BUILT_IN: - case SPV_OPERAND_TYPE_GROUP_OPERATION: - case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: - case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: { - // A single word that is a plain enum value. - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - - // Map an optional operand type to its corresponding concrete type. - if (type == SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER) - operand_.type = SPV_OPERAND_TYPE_ACCESS_QUALIFIER; - - spv_operand_desc entry; - if (grammar_.lookupOperand(type, word, &entry)) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid " << spvOperandTypeStr(operand_.type) - << " operand: " << word; - } - - // Prepare to accept operands to this operand, if needed. - spvPushOperandTypes(entry->operandTypes, expected_operands); - break; - } - - case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: - case SPV_OPERAND_TYPE_FUNCTION_CONTROL: - case SPV_OPERAND_TYPE_LOOP_CONTROL: - case SPV_OPERAND_TYPE_IMAGE: - case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: - case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: - case SPV_OPERAND_TYPE_SELECTION_CONTROL: { - // This operand is a mask. - uint32_t word = 0; - const spv_result_t result = DecodeNonIdWord(&word); - if (result != SPV_SUCCESS) return result; - - inst_words_.push_back(word); - - // Map an optional operand type to its corresponding concrete type. - if (type == SPV_OPERAND_TYPE_OPTIONAL_IMAGE) - operand_.type = SPV_OPERAND_TYPE_IMAGE; - else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS) - operand_.type = SPV_OPERAND_TYPE_MEMORY_ACCESS; - - // Check validity of set mask bits. Also prepare for operands for those - // masks if they have any. To get operand order correct, scan from - // MSB to LSB since we can only prepend operands to a pattern. - // The only case in the grammar where you have more than one mask bit - // having an operand is for image operands. See SPIR-V 3.14 Image - // Operands. - uint32_t remaining_word = word; - for (uint32_t mask = (1u << 31); remaining_word; mask >>= 1) { - if (remaining_word & mask) { - spv_operand_desc entry; - if (grammar_.lookupOperand(type, mask, &entry)) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Invalid " << spvOperandTypeStr(operand_.type) - << " operand: " << word << " has invalid mask component " - << mask; - } - remaining_word ^= mask; - spvPushOperandTypes(entry->operandTypes, expected_operands); - } - } - if (word == 0) { - // An all-zeroes mask *might* also be valid. - spv_operand_desc entry; - if (SPV_SUCCESS == grammar_.lookupOperand(type, 0, &entry)) { - // Prepare for its operands, if any. - spvPushOperandTypes(entry->operandTypes, expected_operands); - } - } - break; - } - default: - return Diag(SPV_ERROR_INVALID_BINARY) - << "Internal error: Unhandled operand type: " << type; - } - - operand_.num_words = uint16_t(inst_words_.size() - first_word_index); - - assert(spvOperandIsConcrete(operand_.type)); - - parsed_operands_.push_back(operand_); - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::DecodeInstruction() { - parsed_operands_.clear(); - inst_words_.clear(); - - // Opcode/num_words placeholder, the word will be filled in later. - inst_words_.push_back(0); - - bool num_operands_still_unknown = true; - { - uint32_t opcode = 0; - uint32_t num_operands = 0; - - const spv_result_t opcode_decoding_result = - DecodeOpcodeAndNumberOfOperands(&opcode, &num_operands); - if (opcode_decoding_result < 0) return opcode_decoding_result; - - if (opcode_decoding_result == SPV_SUCCESS) { - inst_.num_operands = static_cast(num_operands); - num_operands_still_unknown = false; - } else { - if (!reader_.ReadVariableWidthU32(&opcode, - model_->opcode_chunk_length())) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read opcode of instruction"; - } - } - - inst_.opcode = static_cast(opcode); - } - - const SpvOp opcode = static_cast(inst_.opcode); - - spv_opcode_desc opcode_desc; - if (grammar_.lookupOpcode(opcode, &opcode_desc) != SPV_SUCCESS) { - return Diag(SPV_ERROR_INVALID_BINARY) << "Invalid opcode"; - } - - spv_operand_pattern_t expected_operands; - expected_operands.reserve(opcode_desc->numTypes); - for (auto i = 0; i < opcode_desc->numTypes; i++) { - expected_operands.push_back( - opcode_desc->operandTypes[opcode_desc->numTypes - i - 1]); - } - - if (num_operands_still_unknown) { - if (!OpcodeHasFixedNumberOfOperands(opcode)) { - if (!reader_.ReadVariableWidthU16(&inst_.num_operands, - model_->num_operands_chunk_length())) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to read num_operands of instruction"; - } else { - inst_.num_operands = static_cast(expected_operands.size()); - } - } - - for (operand_index_ = 0; - operand_index_ < static_cast(inst_.num_operands); - ++operand_index_) { - assert(!expected_operands.empty()); - const spv_operand_type_t type = - spvTakeFirstMatchableOperand(&expected_operands); - - const size_t operand_offset = inst_words_.size(); - - const spv_result_t decode_result = - DecodeOperand(operand_offset, type, &expected_operands); - - if (decode_result != SPV_SUCCESS) return decode_result; - } - - assert(inst_.num_operands == parsed_operands_.size()); - - // Only valid while inst_words_ and parsed_operands_ remain unchanged (until - // next DecodeInstruction call). - inst_.words = inst_words_.data(); - inst_.operands = parsed_operands_.empty() ? nullptr : parsed_operands_.data(); - inst_.num_words = static_cast(inst_words_.size()); - inst_words_[0] = spvOpcodeMake(inst_.num_words, SpvOp(inst_.opcode)); - - std::copy(inst_words_.begin(), inst_words_.end(), std::back_inserter(spirv_)); - - assert(inst_.num_words == - std::accumulate( - parsed_operands_.begin(), parsed_operands_.end(), 1, - [](int num_words, const spv_parsed_operand_t& operand) { - return num_words += operand.num_words; - }) && - "num_words in instruction doesn't correspond to the sum of num_words" - "in the operands"); - - RecordNumberType(); - ProcessCurInstruction(); - - if (!ReadToByteBreak(MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte)) - return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read to byte break"; - - if (logger_) { - logger_->NewLine(); - std::stringstream ss; - ss << spvOpcodeString(opcode) << " "; - for (size_t index = 1; index < inst_words_.size(); ++index) - ss << inst_words_[index] << " "; - logger_->AppendText(ss.str()); - logger_->NewLine(); - logger_->NewLine(); - if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; - } - - return SPV_SUCCESS; -} - -spv_result_t MarkvDecoder::SetNumericTypeInfoForType( - spv_parsed_operand_t* parsed_operand, uint32_t type_id) { - assert(type_id != 0); - auto type_info_iter = type_id_to_number_type_info_.find(type_id); - if (type_info_iter == type_id_to_number_type_info_.end()) { - return Diag(SPV_ERROR_INVALID_BINARY) - << "Type Id " << type_id << " is not a type"; - } - - const NumberType& info = type_info_iter->second; - if (info.type == SPV_NUMBER_NONE) { - // This is a valid type, but for something other than a scalar number. - return Diag(SPV_ERROR_INVALID_BINARY) - << "Type Id " << type_id << " is not a scalar numeric type"; - } - - parsed_operand->number_kind = info.type; - parsed_operand->number_bit_width = info.bit_width; - // Round up the word count. - parsed_operand->num_words = static_cast((info.bit_width + 31) / 32); - return SPV_SUCCESS; -} - -void MarkvDecoder::RecordNumberType() { - const SpvOp opcode = static_cast(inst_.opcode); - if (spvOpcodeGeneratesType(opcode)) { - NumberType info = {SPV_NUMBER_NONE, 0}; - if (SpvOpTypeInt == opcode) { - info.bit_width = inst_.words[inst_.operands[1].offset]; - info.type = inst_.words[inst_.operands[2].offset] - ? SPV_NUMBER_SIGNED_INT - : SPV_NUMBER_UNSIGNED_INT; - } else if (SpvOpTypeFloat == opcode) { - info.bit_width = inst_.words[inst_.operands[1].offset]; - info.type = SPV_NUMBER_FLOATING; - } - // The *result* Id of a type generating instruction is the type Id. - type_id_to_number_type_info_[inst_.result_id] = info; - } -} - -} // namespace comp -} // namespace spvtools diff --git a/source/comp/markv_decoder.h b/source/comp/markv_decoder.h deleted file mode 100644 index 4d8402b44..000000000 --- a/source/comp/markv_decoder.h +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/comp/bit_stream.h" -#include "source/comp/markv.h" -#include "source/comp/markv_codec.h" -#include "source/comp/markv_logger.h" -#include "source/util/make_unique.h" - -#ifndef SOURCE_COMP_MARKV_DECODER_H_ -#define SOURCE_COMP_MARKV_DECODER_H_ - -namespace spvtools { -namespace comp { - -class MarkvLogger; - -// Decodes MARK-V buffers written by MarkvEncoder. -class MarkvDecoder : public MarkvCodec { - public: - // |model| is owned by the caller, must be not null and valid during the - // lifetime of MarkvEncoder. - MarkvDecoder(spv_const_context context, const std::vector& markv, - const MarkvCodecOptions& options, const MarkvModel* model) - : MarkvCodec(context, GetValidatorOptions(options), model), - options_(options), - reader_(markv) { - SetIdBound(1); - parsed_operands_.reserve(25); - inst_words_.reserve(25); - } - ~MarkvDecoder() = default; - - // Creates an internal logger which writes comments on the decoding process. - void CreateLogger(MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer) { - logger_ = MakeUnique(log_consumer, debug_consumer); - } - - // Decodes SPIR-V from MARK-V and stores the words in |spirv_binary|. - // Can be called only once. Fails if data of wrong format or ends prematurely, - // of if validation fails. - spv_result_t DecodeModule(std::vector* spirv_binary); - - // Creates and returns validator options. Returned value owned by the caller. - static spv_validator_options GetValidatorOptions( - const MarkvCodecOptions& options) { - return options.validate_spirv_binary ? spvValidatorOptionsCreate() - : nullptr; - } - - private: - // Describes the format of a typed literal number. - struct NumberType { - spv_number_kind_t type; - uint32_t bit_width; - }; - - // Reads a single bit from reader_. The read bit is stored in |bit|. - // Returns false iff reader_ fails. - bool ReadBit(bool* bit) { - uint64_t bits = 0; - const bool result = reader_.ReadBits(&bits, 1); - if (result) *bit = bits ? true : false; - return result; - }; - - // Returns ReadBit bound to the class object. - std::function GetReadBitCallback() { - return std::bind(&MarkvDecoder::ReadBit, this, std::placeholders::_1); - } - - // Reads a single non-id word from bit stream. operand_.type determines if - // the word needs to be decoded and how. - spv_result_t DecodeNonIdWord(uint32_t* word); - - // Reads and decodes both opcode and num_operands as a single code. - // Returns SPV_UNSUPPORTED iff no suitable codec was found. - spv_result_t DecodeOpcodeAndNumberOfOperands(uint32_t* opcode, - uint32_t* num_operands); - - // Reads mtf rank from bit stream. |mtf| is used to determine the codec - // scheme. |fallback_method| is used if no codec defined for |mtf|. - spv_result_t DecodeMtfRankHuffman(uint64_t mtf, uint32_t fallback_method, - uint32_t* rank); - - // Reads id using coding based on mtf associated with the id descriptor. - // Returns SPV_UNSUPPORTED iff fallback method needs to be used. - spv_result_t DecodeIdWithDescriptor(uint32_t* id); - - // Reads id using coding based on the given |mtf|, which is expected to - // contain the needed |id|. - spv_result_t DecodeExistingId(uint64_t mtf, uint32_t* id); - - // Reads type id of the current instruction if can't be inferred. - spv_result_t DecodeTypeId(); - - // Reads result id of the current instruction if can't be inferred. - spv_result_t DecodeResultId(); - - // Reads id which is neither type nor result id. - spv_result_t DecodeRefId(uint32_t* id); - - // Reads and discards bits until the beginning of the next byte if the - // number of bits until the next byte is less than |byte_break_if_less_than|. - bool ReadToByteBreak(size_t byte_break_if_less_than); - - // Returns instruction words decoded up to this point. - const uint32_t* GetInstWords() const override { return inst_words_.data(); } - - // Reads a literal number as it is described in |operand| from the bit stream, - // decodes and writes it to spirv_. - spv_result_t DecodeLiteralNumber(const spv_parsed_operand_t& operand); - - // Reads instruction from bit stream, decodes and validates it. - // Decoded instruction is valid until the next call of DecodeInstruction(). - spv_result_t DecodeInstruction(); - - // Read operand from the stream decodes and validates it. - spv_result_t DecodeOperand(size_t operand_offset, - const spv_operand_type_t type, - spv_operand_pattern_t* expected_operands); - - // Records the numeric type for an operand according to the type information - // associated with the given non-zero type Id. This can fail if the type Id - // is not a type Id, or if the type Id does not reference a scalar numeric - // type. On success, return SPV_SUCCESS and populates the num_words, - // number_kind, and number_bit_width fields of parsed_operand. - spv_result_t SetNumericTypeInfoForType(spv_parsed_operand_t* parsed_operand, - uint32_t type_id); - - // Records the number type for the current instruction, if it generates a - // type. For types that aren't scalar numbers, record something with number - // kind SPV_NUMBER_NONE. - void RecordNumberType(); - - MarkvCodecOptions options_; - - // Temporary sink where decoded SPIR-V words are written. Once it contains the - // entire module, the container is moved and returned. - std::vector spirv_; - - // Bit stream containing encoded data. - BitReaderWord64 reader_; - - // Temporary storage for operands of the currently parsed instruction. - // Valid until next DecodeInstruction call. - std::vector parsed_operands_; - - // Temporary storage for current instruction words. - // Valid until next DecodeInstruction call. - std::vector inst_words_; - - // Maps a type ID to its number type description. - std::unordered_map type_id_to_number_type_info_; - - // Maps an ExtInstImport id to the extended instruction type. - std::unordered_map import_id_to_ext_inst_type_; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MARKV_DECODER_H_ diff --git a/source/comp/markv_encoder.cpp b/source/comp/markv_encoder.cpp deleted file mode 100644 index 1abd58646..000000000 --- a/source/comp/markv_encoder.cpp +++ /dev/null @@ -1,486 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/comp/markv_encoder.h" - -#include "source/binary.h" -#include "source/opcode.h" -#include "spirv-tools/libspirv.hpp" - -namespace spvtools { -namespace comp { -namespace { - -const size_t kCommentNumWhitespaces = 2; - -} // namespace - -spv_result_t MarkvEncoder::EncodeNonIdWord(uint32_t word) { - auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); - - if (codec) { - uint64_t bits = 0; - size_t num_bits = 0; - if (codec->Encode(word, &bits, &num_bits)) { - // Encoding successful. - writer_.WriteBits(bits, num_bits); - return SPV_SUCCESS; - } else { - // Encoding failed, write kMarkvNoneOfTheAbove flag. - if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, - &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Non-id word Huffman table for " - << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " - << operand_index_ << " is missing kMarkvNoneOfTheAbove"; - writer_.WriteBits(bits, num_bits); - } - } - - // Fallback encoding. - const size_t chunk_length = - model_->GetOperandVariableWidthChunkLength(operand_.type); - if (chunk_length) { - writer_.WriteVariableWidthU32(word, chunk_length); - } else { - writer_.WriteUnencoded(word); - } - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeOpcodeAndNumOperands(uint32_t opcode, - uint32_t num_operands) { - uint64_t bits = 0; - size_t num_bits = 0; - - const uint32_t word = opcode | (num_operands << 16); - - // First try to use the Markov chain codec. - auto* codec = - model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); - if (codec) { - if (codec->Encode(word, &bits, &num_bits)) { - // The word was successfully encoded into bits/num_bits. - writer_.WriteBits(bits, num_bits); - return SPV_SUCCESS; - } else { - // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove - // and use fallback encoding. - if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, - &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "opcode_and_num_operands Huffman table for " - << spvOpcodeString(GetPrevOpcode()) - << "is missing kMarkvNoneOfTheAbove"; - writer_.WriteBits(bits, num_bits); - } - } - - // Fallback to base-rate codec. - codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); - assert(codec); - if (codec->Encode(word, &bits, &num_bits)) { - // The word was successfully encoded into bits/num_bits. - writer_.WriteBits(bits, num_bits); - return SPV_SUCCESS; - } else { - // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove - // and return false. - if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Global opcode_and_num_operands Huffman table is missing " - << "kMarkvNoneOfTheAbove"; - writer_.WriteBits(bits, num_bits); - return SPV_UNSUPPORTED; - } -} - -spv_result_t MarkvEncoder::EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, - uint64_t fallback_method) { - const auto* codec = GetMtfHuffmanCodec(mtf); - if (!codec) { - assert(fallback_method != kMtfNone); - codec = GetMtfHuffmanCodec(fallback_method); - } - - if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to encode MTF rank"; - - uint64_t bits = 0; - size_t num_bits = 0; - if (rank < MarkvCodec::kMtfSmallestRankEncodedByValue) { - // Encode using Huffman coding. - if (!codec->Encode(rank, &bits, &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to encode MTF rank with Huffman"; - - writer_.WriteBits(bits, num_bits); - } else { - // Encode by value. - if (!codec->Encode(MarkvCodec::kMtfRankEncodedByValueSignal, &bits, - &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to encode kMtfRankEncodedByValueSignal"; - - writer_.WriteBits(bits, num_bits); - writer_.WriteVariableWidthU32( - rank - MarkvCodec::kMtfSmallestRankEncodedByValue, - model_->mtf_rank_chunk_length()); - } - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeIdWithDescriptor(uint32_t id) { - // Get the descriptor for id. - const uint32_t long_descriptor = long_id_descriptors_.GetDescriptor(id); - auto* codec = - model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); - uint64_t bits = 0; - size_t num_bits = 0; - uint64_t mtf = kMtfNone; - if (long_descriptor && codec && - codec->Encode(long_descriptor, &bits, &num_bits)) { - // If the descriptor exists and is in the table, write the descriptor and - // proceed to encoding the rank. - writer_.WriteBits(bits, num_bits); - mtf = GetMtfLongIdDescriptor(long_descriptor); - } else { - if (codec) { - // The descriptor doesn't exist or we have no coding for it. Write - // kMarkvNoneOfTheAbove and go to fallback method. - if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, - &num_bits)) - return Diag(SPV_ERROR_INTERNAL) - << "Descriptor Huffman table for " - << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " - << operand_index_ << " is missing kMarkvNoneOfTheAbove"; - - writer_.WriteBits(bits, num_bits); - } - - if (model_->id_fallback_strategy() != - MarkvModel::IdFallbackStrategy::kShortDescriptor) { - return SPV_UNSUPPORTED; - } - - const uint32_t short_descriptor = short_id_descriptors_.GetDescriptor(id); - writer_.WriteBits(short_descriptor, MarkvCodec::kShortDescriptorNumBits); - - if (short_descriptor == 0) { - // Forward declared id. - return SPV_UNSUPPORTED; - } - - mtf = GetMtfShortIdDescriptor(short_descriptor); - } - - // Descriptor has been encoded. Now encode the rank of the id in the - // associated mtf sequence. - return EncodeExistingId(mtf, id); -} - -spv_result_t MarkvEncoder::EncodeExistingId(uint64_t mtf, uint32_t id) { - assert(multi_mtf_.GetSize(mtf) > 0); - if (multi_mtf_.GetSize(mtf) == 1) { - // If the sequence has only one element no need to write rank, the decoder - // would make the same decision. - return SPV_SUCCESS; - } - - uint32_t rank = 0; - if (!multi_mtf_.RankFromValue(mtf, id, &rank)) - return Diag(SPV_ERROR_INTERNAL) << "Id is not in the MTF sequence"; - - return EncodeMtfRankHuffman(rank, mtf, kMtfGenericNonZeroRank); -} - -spv_result_t MarkvEncoder::EncodeRefId(uint32_t id) { - { - // Try to encode using id descriptor mtfs. - const spv_result_t result = EncodeIdWithDescriptor(id); - if (result != SPV_UNSUPPORTED) return result; - // If can't be done continue with other methods. - } - - const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( - SpvOp(inst_.opcode))(operand_index_); - uint32_t rank = 0; - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - // Encode using rule-based mtf. - uint64_t mtf = GetRuleBasedMtf(); - - if (mtf != kMtfNone && !can_forward_declare) { - assert(multi_mtf_.HasValue(kMtfAll, id)); - return EncodeExistingId(mtf, id); - } - - if (mtf == kMtfNone) mtf = kMtfAll; - - if (!multi_mtf_.RankFromValue(mtf, id, &rank)) { - // This is the first occurrence of a forward declared id. - multi_mtf_.Insert(kMtfAll, id); - multi_mtf_.Insert(kMtfForwardDeclared, id); - if (mtf != kMtfAll) multi_mtf_.Insert(mtf, id); - rank = 0; - } - - return EncodeMtfRankHuffman(rank, mtf, kMtfAll); - } else { - assert(can_forward_declare); - - if (!multi_mtf_.RankFromValue(kMtfForwardDeclared, id, &rank)) { - // This is the first occurrence of a forward declared id. - multi_mtf_.Insert(kMtfForwardDeclared, id); - rank = 0; - } - - writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); - return SPV_SUCCESS; - } -} - -spv_result_t MarkvEncoder::EncodeTypeId() { - if (inst_.opcode == SpvOpFunctionParameter) { - assert(!remaining_function_parameter_types_.empty()); - assert(inst_.type_id == remaining_function_parameter_types_.front()); - remaining_function_parameter_types_.pop_front(); - return SPV_SUCCESS; - } - - { - // Try to encode using id descriptor mtfs. - const spv_result_t result = EncodeIdWithDescriptor(inst_.type_id); - if (result != SPV_UNSUPPORTED) return result; - // If can't be done continue with other methods. - } - - assert(model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased); - - uint64_t mtf = GetRuleBasedMtf(); - assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( - operand_index_)); - - if (mtf == kMtfNone) { - mtf = kMtfTypeNonFunction; - // Function types should have been handled by GetRuleBasedMtf. - assert(inst_.opcode != SpvOpFunction); - } - - return EncodeExistingId(mtf, inst_.type_id); -} - -spv_result_t MarkvEncoder::EncodeResultId() { - uint32_t rank = 0; - - const uint64_t num_still_forward_declared = - multi_mtf_.GetSize(kMtfForwardDeclared); - - if (num_still_forward_declared) { - // We write the rank only if kMtfForwardDeclared is not empty. If it is - // empty the decoder knows that there are no forward declared ids to expect. - if (multi_mtf_.RankFromValue(kMtfForwardDeclared, inst_.result_id, &rank)) { - // This is a definition of a forward declared id. We can remove the id - // from kMtfForwardDeclared. - if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) - return Diag(SPV_ERROR_INTERNAL) - << "Failed to remove id from kMtfForwardDeclared"; - writer_.WriteBits(1, 1); - writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); - } else { - rank = 0; - writer_.WriteBits(0, 1); - } - } - - if (model_->id_fallback_strategy() == - MarkvModel::IdFallbackStrategy::kRuleBased) { - if (!rank) { - multi_mtf_.Insert(kMtfAll, inst_.result_id); - } - } - - return SPV_SUCCESS; -} - -spv_result_t MarkvEncoder::EncodeLiteralNumber( - const spv_parsed_operand_t& operand) { - if (operand.number_bit_width <= 32) { - const uint32_t word = inst_.words[operand.offset]; - return EncodeNonIdWord(word); - } else { - assert(operand.number_bit_width <= 64); - const uint64_t word = uint64_t(inst_.words[operand.offset]) | - (uint64_t(inst_.words[operand.offset + 1]) << 32); - if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { - writer_.WriteVariableWidthU64(word, model_->u64_chunk_length()); - } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { - int64_t val = 0; - std::memcpy(&val, &word, 8); - writer_.WriteVariableWidthS64(val, model_->s64_chunk_length(), - model_->s64_block_exponent()); - } else if (operand.number_kind == SPV_NUMBER_FLOATING) { - writer_.WriteUnencoded(word); - } else { - return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; - } - } - return SPV_SUCCESS; -} - -void MarkvEncoder::AddByteBreak(size_t byte_break_if_less_than) { - const size_t num_bits_to_next_byte = - GetNumBitsToNextByte(writer_.GetNumBits()); - if (num_bits_to_next_byte == 0 || - num_bits_to_next_byte > byte_break_if_less_than) - return; - - if (logger_) { - logger_->AppendWhitespaces(kCommentNumWhitespaces); - logger_->AppendText(""); - } - - writer_.WriteBits(0, num_bits_to_next_byte); -} - -spv_result_t MarkvEncoder::EncodeInstruction( - const spv_parsed_instruction_t& inst) { - SpvOp opcode = SpvOp(inst.opcode); - inst_ = inst; - - LogDisassemblyInstruction(); - - const spv_result_t opcode_encodig_result = - EncodeOpcodeAndNumOperands(opcode, inst.num_operands); - if (opcode_encodig_result < 0) return opcode_encodig_result; - - if (opcode_encodig_result != SPV_SUCCESS) { - // Fallback encoding for opcode and num_operands. - writer_.WriteVariableWidthU32(opcode, model_->opcode_chunk_length()); - - if (!OpcodeHasFixedNumberOfOperands(opcode)) { - // If the opcode has a variable number of operands, encode the number of - // operands with the instruction. - - if (logger_) logger_->AppendWhitespaces(kCommentNumWhitespaces); - - writer_.WriteVariableWidthU16(inst.num_operands, - model_->num_operands_chunk_length()); - } - } - - // Write operands. - const uint32_t num_operands = inst_.num_operands; - for (operand_index_ = 0; operand_index_ < num_operands; ++operand_index_) { - operand_ = inst_.operands[operand_index_]; - - if (logger_) { - logger_->AppendWhitespaces(kCommentNumWhitespaces); - logger_->AppendText("<"); - logger_->AppendText(spvOperandTypeStr(operand_.type)); - logger_->AppendText(">"); - } - - switch (operand_.type) { - case SPV_OPERAND_TYPE_RESULT_ID: - case SPV_OPERAND_TYPE_TYPE_ID: - case SPV_OPERAND_TYPE_ID: - case SPV_OPERAND_TYPE_OPTIONAL_ID: - case SPV_OPERAND_TYPE_SCOPE_ID: - case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { - const uint32_t id = inst_.words[operand_.offset]; - if (operand_.type == SPV_OPERAND_TYPE_TYPE_ID) { - const spv_result_t result = EncodeTypeId(); - if (result != SPV_SUCCESS) return result; - } else if (operand_.type == SPV_OPERAND_TYPE_RESULT_ID) { - const spv_result_t result = EncodeResultId(); - if (result != SPV_SUCCESS) return result; - } else { - const spv_result_t result = EncodeRefId(id); - if (result != SPV_SUCCESS) return result; - } - - PromoteIfNeeded(id); - break; - } - - case SPV_OPERAND_TYPE_LITERAL_INTEGER: { - const spv_result_t result = - EncodeNonIdWord(inst_.words[operand_.offset]); - if (result != SPV_SUCCESS) return result; - break; - } - - case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { - const spv_result_t result = EncodeLiteralNumber(operand_); - if (result != SPV_SUCCESS) return result; - break; - } - - case SPV_OPERAND_TYPE_LITERAL_STRING: { - const char* src = - reinterpret_cast(&inst_.words[operand_.offset]); - - auto* codec = model_->GetLiteralStringHuffmanCodec(opcode); - if (codec) { - uint64_t bits = 0; - size_t num_bits = 0; - const std::string str = src; - if (codec->Encode(str, &bits, &num_bits)) { - writer_.WriteBits(bits, num_bits); - break; - } else { - bool result = - codec->Encode("kMarkvNoneOfTheAbove", &bits, &num_bits); - (void)result; - assert(result); - writer_.WriteBits(bits, num_bits); - } - } - - const size_t length = spv_strnlen_s(src, operand_.num_words * 4); - if (length == operand_.num_words * 4) - return Diag(SPV_ERROR_INVALID_BINARY) - << "Failed to find terminal character of literal string"; - for (size_t i = 0; i < length + 1; ++i) writer_.WriteUnencoded(src[i]); - break; - } - - default: { - for (int i = 0; i < operand_.num_words; ++i) { - const uint32_t word = inst_.words[operand_.offset + i]; - const spv_result_t result = EncodeNonIdWord(word); - if (result != SPV_SUCCESS) return result; - } - break; - } - } - } - - AddByteBreak(MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte); - - if (logger_) { - logger_->NewLine(); - logger_->NewLine(); - if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; - } - - ProcessCurInstruction(); - - return SPV_SUCCESS; -} - -} // namespace comp -} // namespace spvtools diff --git a/source/comp/markv_encoder.h b/source/comp/markv_encoder.h deleted file mode 100644 index 21843123f..000000000 --- a/source/comp/markv_encoder.h +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/comp/bit_stream.h" -#include "source/comp/markv.h" -#include "source/comp/markv_codec.h" -#include "source/comp/markv_logger.h" -#include "source/util/make_unique.h" - -#ifndef SOURCE_COMP_MARKV_ENCODER_H_ -#define SOURCE_COMP_MARKV_ENCODER_H_ - -#include - -namespace spvtools { -namespace comp { - -// SPIR-V to MARK-V encoder. Exposes functions EncodeHeader and -// EncodeInstruction which can be used as callback by spvBinaryParse. -// Encoded binary is written to an internally maintained bitstream. -// After the last instruction is encoded, the resulting MARK-V binary can be -// acquired by calling GetMarkvBinary(). -// -// The encoder uses SPIR-V validator to keep internal state, therefore -// SPIR-V binary needs to be able to pass validator checks. -// CreateCommentsLogger() can be used to enable the encoder to write comments -// on how encoding was done, which can later be accessed with GetComments(). -class MarkvEncoder : public MarkvCodec { - public: - // |model| is owned by the caller, must be not null and valid during the - // lifetime of MarkvEncoder. - MarkvEncoder(spv_const_context context, const MarkvCodecOptions& options, - const MarkvModel* model) - : MarkvCodec(context, GetValidatorOptions(options), model), - options_(options) {} - ~MarkvEncoder() override = default; - - // Writes data from SPIR-V header to MARK-V header. - spv_result_t EncodeHeader(spv_endianness_t /* endian */, uint32_t /* magic */, - uint32_t version, uint32_t generator, - uint32_t id_bound, uint32_t /* schema */) { - SetIdBound(id_bound); - header_.spirv_version = version; - header_.spirv_generator = generator; - return SPV_SUCCESS; - } - - // Creates an internal logger which writes comments on the encoding process. - void CreateLogger(MarkvLogConsumer log_consumer, - MarkvDebugConsumer debug_consumer) { - logger_ = MakeUnique(log_consumer, debug_consumer); - writer_.SetCallback( - [this](const std::string& str) { logger_->AppendBitSequence(str); }); - } - - // Encodes SPIR-V instruction to MARK-V and writes to bit stream. - // Operation can fail if the instruction fails to pass the validator or if - // the encoder stubmles on something unexpected. - spv_result_t EncodeInstruction(const spv_parsed_instruction_t& inst); - - // Concatenates MARK-V header and the bit stream with encoded instructions - // into a single buffer and returns it as spv_markv_binary. The returned - // value is owned by the caller and needs to be destroyed with - // spvMarkvBinaryDestroy(). - std::vector GetMarkvBinary() { - header_.markv_length_in_bits = - static_cast(sizeof(header_) * 8 + writer_.GetNumBits()); - header_.markv_model = - (model_->model_type() << 16) | model_->model_version(); - - const size_t num_bytes = sizeof(header_) + writer_.GetDataSizeBytes(); - std::vector markv(num_bytes); - - assert(writer_.GetData()); - std::memcpy(markv.data(), &header_, sizeof(header_)); - std::memcpy(markv.data() + sizeof(header_), writer_.GetData(), - writer_.GetDataSizeBytes()); - return markv; - } - - // Optionally adds disassembly to the comments. - // Disassembly should contain all instructions in the module separated by - // \n, and no header. - void SetDisassembly(std::string&& disassembly) { - disassembly_ = MakeUnique(std::move(disassembly)); - } - - // Extracts the next instruction line from the disassembly and logs it. - void LogDisassemblyInstruction() { - if (logger_ && disassembly_) { - std::string line; - std::getline(*disassembly_, line, '\n'); - logger_->AppendTextNewLine(line); - } - } - - private: - // Creates and returns validator options. Returned value owned by the caller. - static spv_validator_options GetValidatorOptions( - const MarkvCodecOptions& options) { - return options.validate_spirv_binary ? spvValidatorOptionsCreate() - : nullptr; - } - - // Writes a single word to bit stream. operand_.type determines if the word is - // encoded and how. - spv_result_t EncodeNonIdWord(uint32_t word); - - // Writes both opcode and num_operands as a single code. - // Returns SPV_UNSUPPORTED iff no suitable codec was found. - spv_result_t EncodeOpcodeAndNumOperands(uint32_t opcode, - uint32_t num_operands); - - // Writes mtf rank to bit stream. |mtf| is used to determine the codec - // scheme. |fallback_method| is used if no codec defined for |mtf|. - spv_result_t EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, - uint64_t fallback_method); - - // Writes id using coding based on mtf associated with the id descriptor. - // Returns SPV_UNSUPPORTED iff fallback method needs to be used. - spv_result_t EncodeIdWithDescriptor(uint32_t id); - - // Writes id using coding based on the given |mtf|, which is expected to - // contain the given |id|. - spv_result_t EncodeExistingId(uint64_t mtf, uint32_t id); - - // Writes type id of the current instruction if can't be inferred. - spv_result_t EncodeTypeId(); - - // Writes result id of the current instruction if can't be inferred. - spv_result_t EncodeResultId(); - - // Writes ids which are neither type nor result ids. - spv_result_t EncodeRefId(uint32_t id); - - // Writes bits to the stream until the beginning of the next byte if the - // number of bits until the next byte is less than |byte_break_if_less_than|. - void AddByteBreak(size_t byte_break_if_less_than); - - // Encodes a literal number operand and writes it to the bit stream. - spv_result_t EncodeLiteralNumber(const spv_parsed_operand_t& operand); - - MarkvCodecOptions options_; - - // Bit stream where encoded instructions are written. - BitWriterWord64 writer_; - - // If not nullptr, disassembled instruction lines will be written to comments. - // Format: \n separated instruction lines, no header. - std::unique_ptr disassembly_; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MARKV_ENCODER_H_ diff --git a/source/comp/markv_logger.h b/source/comp/markv_logger.h deleted file mode 100644 index c07fe97b7..000000000 --- a/source/comp/markv_logger.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SOURCE_COMP_MARKV_LOGGER_H_ -#define SOURCE_COMP_MARKV_LOGGER_H_ - -#include "source/comp/markv.h" - -namespace spvtools { -namespace comp { - -class MarkvLogger { - public: - MarkvLogger(MarkvLogConsumer log_consumer, MarkvDebugConsumer debug_consumer) - : log_consumer_(log_consumer), debug_consumer_(debug_consumer) {} - - void AppendText(const std::string& str) { - Append(str); - use_delimiter_ = false; - } - - void AppendTextNewLine(const std::string& str) { - Append(str); - Append("\n"); - use_delimiter_ = false; - } - - void AppendBitSequence(const std::string& str) { - if (debug_consumer_) instruction_bits_ << str; - if (use_delimiter_) Append("-"); - Append(str); - use_delimiter_ = true; - } - - void AppendWhitespaces(size_t num) { - Append(std::string(num, ' ')); - use_delimiter_ = false; - } - - void NewLine() { - Append("\n"); - use_delimiter_ = false; - } - - bool DebugInstruction(const spv_parsed_instruction_t& inst) { - bool result = true; - if (debug_consumer_) { - result = debug_consumer_( - std::vector(inst.words, inst.words + inst.num_words), - instruction_bits_.str(), instruction_comment_.str()); - instruction_bits_.str(std::string()); - instruction_comment_.str(std::string()); - } - return result; - } - - private: - MarkvLogger(const MarkvLogger&) = delete; - MarkvLogger(MarkvLogger&&) = delete; - MarkvLogger& operator=(const MarkvLogger&) = delete; - MarkvLogger& operator=(MarkvLogger&&) = delete; - - void Append(const std::string& str) { - if (log_consumer_) log_consumer_(str); - if (debug_consumer_) instruction_comment_ << str; - } - - MarkvLogConsumer log_consumer_; - MarkvDebugConsumer debug_consumer_; - - std::stringstream instruction_bits_; - std::stringstream instruction_comment_; - - // If true a delimiter will be appended before the next bit sequence. - // Used to generate outputs like: 1100-0 1110-1-1100-1-1111-0 110-0. - bool use_delimiter_ = false; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MARKV_LOGGER_H_ diff --git a/source/comp/markv_model.h b/source/comp/markv_model.h deleted file mode 100644 index d03df02df..000000000 --- a/source/comp/markv_model.h +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SOURCE_COMP_MARKV_MODEL_H_ -#define SOURCE_COMP_MARKV_MODEL_H_ - -#include - -#include "source/comp/huffman_codec.h" -#include "source/latest_version_spirv_header.h" -#include "spirv-tools/libspirv.hpp" - -namespace spvtools { -namespace comp { - -// Base class for MARK-V models. -// The class contains encoding/decoding model with various constants and -// codecs used by the compression algorithm. -class MarkvModel { - public: - MarkvModel() - : operand_chunk_lengths_( - static_cast(SPV_OPERAND_TYPE_NUM_OPERAND_TYPES), 0) { - // Set default values. - operand_chunk_lengths_[SPV_OPERAND_TYPE_TYPE_ID] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_RESULT_ID] = 8; - operand_chunk_lengths_[SPV_OPERAND_TYPE_ID] = 8; - operand_chunk_lengths_[SPV_OPERAND_TYPE_SCOPE_ID] = 8; - operand_chunk_lengths_[SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID] = 8; - operand_chunk_lengths_[SPV_OPERAND_TYPE_LITERAL_INTEGER] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_CAPABILITY] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_SOURCE_LANGUAGE] = 3; - operand_chunk_lengths_[SPV_OPERAND_TYPE_EXECUTION_MODEL] = 3; - operand_chunk_lengths_[SPV_OPERAND_TYPE_ADDRESSING_MODEL] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_MEMORY_MODEL] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_EXECUTION_MODE] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_STORAGE_CLASS] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_DIMENSIONALITY] = 3; - operand_chunk_lengths_[SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE] = 3; - operand_chunk_lengths_[SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_FP_ROUNDING_MODE] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_LINKAGE_TYPE] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_ACCESS_QUALIFIER] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE] = 3; - operand_chunk_lengths_[SPV_OPERAND_TYPE_DECORATION] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_BUILT_IN] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_GROUP_OPERATION] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO] = 2; - operand_chunk_lengths_[SPV_OPERAND_TYPE_FP_FAST_MATH_MODE] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_FUNCTION_CONTROL] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_LOOP_CONTROL] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_IMAGE] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_IMAGE] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_SELECTION_CONTROL] = 4; - operand_chunk_lengths_[SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER] = 6; - operand_chunk_lengths_[SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER] = 6; - } - - uint32_t model_type() const { return model_type_; } - uint32_t model_version() const { return model_version_; } - - uint32_t opcode_chunk_length() const { return opcode_chunk_length_; } - uint32_t num_operands_chunk_length() const { - return num_operands_chunk_length_; - } - uint32_t mtf_rank_chunk_length() const { return mtf_rank_chunk_length_; } - - uint32_t u64_chunk_length() const { return u64_chunk_length_; } - uint32_t s64_chunk_length() const { return s64_chunk_length_; } - uint32_t s64_block_exponent() const { return s64_block_exponent_; } - - enum class IdFallbackStrategy { - kRuleBased = 0, - kShortDescriptor, - }; - - IdFallbackStrategy id_fallback_strategy() const { - return id_fallback_strategy_; - } - - // Returns a codec for common opcode_and_num_operands words for the given - // previous opcode. May return nullptr if the codec doesn't exist. - const HuffmanCodec* GetOpcodeAndNumOperandsMarkovHuffmanCodec( - uint32_t prev_opcode) const { - if (prev_opcode == SpvOpNop) - return opcode_and_num_operands_huffman_codec_.get(); - - const auto it = - opcode_and_num_operands_markov_huffman_codecs_.find(prev_opcode); - if (it == opcode_and_num_operands_markov_huffman_codecs_.end()) - return nullptr; - return it->second.get(); - } - - // Returns a codec for common non-id words used for given operand slot. - // Operand slot is defined by the opcode and the operand index. - // May return nullptr if the codec doesn't exist. - const HuffmanCodec* GetNonIdWordHuffmanCodec( - uint32_t opcode, uint32_t operand_index) const { - const auto it = non_id_word_huffman_codecs_.find( - std::pair(opcode, operand_index)); - if (it == non_id_word_huffman_codecs_.end()) return nullptr; - return it->second.get(); - } - - // Returns a codec for common id descriptos used for given operand slot. - // Operand slot is defined by the opcode and the operand index. - // May return nullptr if the codec doesn't exist. - const HuffmanCodec* GetIdDescriptorHuffmanCodec( - uint32_t opcode, uint32_t operand_index) const { - const auto it = id_descriptor_huffman_codecs_.find( - std::pair(opcode, operand_index)); - if (it == id_descriptor_huffman_codecs_.end()) return nullptr; - return it->second.get(); - } - - // Returns a codec for common strings used by the given opcode. - // Operand slot is defined by the opcode and the operand index. - // May return nullptr if the codec doesn't exist. - const HuffmanCodec* GetLiteralStringHuffmanCodec( - uint32_t opcode) const { - const auto it = literal_string_huffman_codecs_.find(opcode); - if (it == literal_string_huffman_codecs_.end()) return nullptr; - return it->second.get(); - } - - // Checks if |descriptor| has a coding scheme in any of - // id_descriptor_huffman_codecs_. - bool DescriptorHasCodingScheme(uint32_t descriptor) const { - return descriptors_with_coding_scheme_.count(descriptor); - } - - // Checks if any descriptor has a coding scheme. - bool AnyDescriptorHasCodingScheme() const { - return !descriptors_with_coding_scheme_.empty(); - } - - // Returns chunk length used for variable length encoding of spirv operand - // words. - uint32_t GetOperandVariableWidthChunkLength(spv_operand_type_t type) const { - return operand_chunk_lengths_.at(static_cast(type)); - } - - // Sets model type. - void SetModelType(uint32_t in_model_type) { model_type_ = in_model_type; } - - // Sets model version. - void SetModelVersion(uint32_t in_model_version) { - model_version_ = in_model_version; - } - - // Returns value used by Huffman codecs as a signal that a value is not in the - // coding table. - static uint64_t GetMarkvNoneOfTheAbove() { - // Magic number. - return 1111111111111111111; - } - - MarkvModel(const MarkvModel&) = delete; - const MarkvModel& operator=(const MarkvModel&) = delete; - - protected: - // Huffman codec for base-rate of opcode_and_num_operands. - std::unique_ptr> - opcode_and_num_operands_huffman_codec_; - - // Huffman codecs for opcode_and_num_operands. The map key is previous opcode. - std::map>> - opcode_and_num_operands_markov_huffman_codecs_; - - // Huffman codecs for non-id single-word operand values. - // The map key is pair . - std::map, - std::unique_ptr>> - non_id_word_huffman_codecs_; - - // Huffman codecs for id descriptors. The map key is pair - // . - std::map, - std::unique_ptr>> - id_descriptor_huffman_codecs_; - - // Set of all descriptors which have a coding scheme in any of - // id_descriptor_huffman_codecs_. - std::unordered_set descriptors_with_coding_scheme_; - - // Huffman codecs for literal strings. The map key is the opcode of the - // current instruction. This assumes, that there is no more than one literal - // string operand per instruction, but would still work even if this is not - // the case. Names and debug information strings are not collected. - std::map>> - literal_string_huffman_codecs_; - - // Chunk lengths used for variable width encoding of operands (index is - // spv_operand_type of the operand). - std::vector operand_chunk_lengths_; - - uint32_t opcode_chunk_length_ = 7; - uint32_t num_operands_chunk_length_ = 3; - uint32_t mtf_rank_chunk_length_ = 5; - - uint32_t u64_chunk_length_ = 8; - uint32_t s64_chunk_length_ = 8; - uint32_t s64_block_exponent_ = 10; - - IdFallbackStrategy id_fallback_strategy_ = - IdFallbackStrategy::kShortDescriptor; - - uint32_t model_type_ = 0; - uint32_t model_version_ = 0; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MARKV_MODEL_H_ diff --git a/source/comp/move_to_front.cpp b/source/comp/move_to_front.cpp deleted file mode 100644 index 9d35a3f5b..000000000 --- a/source/comp/move_to_front.cpp +++ /dev/null @@ -1,456 +0,0 @@ -// Copyright (c) 2018 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/comp/move_to_front.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace spvtools { -namespace comp { - -bool MoveToFront::Insert(uint32_t value) { - auto it = value_to_node_.find(value); - if (it != value_to_node_.end() && IsInTree(it->second)) return false; - - const uint32_t old_size = GetSize(); - (void)old_size; - - InsertNode(CreateNode(next_timestamp_++, value)); - - last_accessed_value_ = value; - last_accessed_value_valid_ = true; - - assert(value_to_node_.count(value)); - assert(old_size + 1 == GetSize()); - return true; -} - -bool MoveToFront::Remove(uint32_t value) { - auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) return false; - - if (!IsInTree(it->second)) return false; - - if (last_accessed_value_ == value) last_accessed_value_valid_ = false; - - const uint32_t orphan = RemoveNode(it->second); - (void)orphan; - // The node of |value| is still alive but it's orphaned now. Can still be - // reused later. - assert(!IsInTree(orphan)); - assert(ValueOf(orphan) == value); - return true; -} - -bool MoveToFront::RankFromValue(uint32_t value, uint32_t* rank) { - if (last_accessed_value_valid_ && last_accessed_value_ == value) { - *rank = 1; - return true; - } - - const uint32_t old_size = GetSize(); - if (old_size == 1) { - if (ValueOf(root_) == value) { - *rank = 1; - return true; - } else { - return false; - } - } - - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) { - return false; - } - - uint32_t target = it->second; - - if (!IsInTree(target)) { - return false; - } - - uint32_t node = target; - *rank = 1 + SizeOf(LeftOf(node)); - while (node) { - if (IsRightChild(node)) *rank += 1 + SizeOf(LeftOf(ParentOf(node))); - node = ParentOf(node); - } - - // Don't update timestamp if the node has rank 1. - if (*rank != 1) { - // Update timestamp and reposition the node. - target = RemoveNode(target); - assert(ValueOf(target) == value); - assert(old_size == GetSize() + 1); - MutableTimestampOf(target) = next_timestamp_++; - InsertNode(target); - assert(old_size == GetSize()); - } - - last_accessed_value_ = value; - last_accessed_value_valid_ = true; - return true; -} - -bool MoveToFront::HasValue(uint32_t value) const { - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) { - return false; - } - - return IsInTree(it->second); -} - -bool MoveToFront::Promote(uint32_t value) { - if (last_accessed_value_valid_ && last_accessed_value_ == value) { - return true; - } - - const uint32_t old_size = GetSize(); - if (old_size == 1) return ValueOf(root_) == value; - - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) { - return false; - } - - uint32_t target = it->second; - - if (!IsInTree(target)) { - return false; - } - - // Update timestamp and reposition the node. - target = RemoveNode(target); - assert(ValueOf(target) == value); - assert(old_size == GetSize() + 1); - - MutableTimestampOf(target) = next_timestamp_++; - InsertNode(target); - assert(old_size == GetSize()); - - last_accessed_value_ = value; - last_accessed_value_valid_ = true; - return true; -} - -bool MoveToFront::ValueFromRank(uint32_t rank, uint32_t* value) { - if (last_accessed_value_valid_ && rank == 1) { - *value = last_accessed_value_; - return true; - } - - const uint32_t old_size = GetSize(); - if (rank <= 0 || rank > old_size) { - return false; - } - - if (old_size == 1) { - *value = ValueOf(root_); - return true; - } - - const bool update_timestamp = (rank != 1); - - uint32_t node = root_; - while (node) { - const uint32_t left_subtree_num_nodes = SizeOf(LeftOf(node)); - if (rank == left_subtree_num_nodes + 1) { - // This is the node we are looking for. - // Don't update timestamp if the node has rank 1. - if (update_timestamp) { - node = RemoveNode(node); - assert(old_size == GetSize() + 1); - MutableTimestampOf(node) = next_timestamp_++; - InsertNode(node); - assert(old_size == GetSize()); - } - *value = ValueOf(node); - last_accessed_value_ = *value; - last_accessed_value_valid_ = true; - return true; - } - - if (rank < left_subtree_num_nodes + 1) { - // Descend into the left subtree. The rank is still valid. - node = LeftOf(node); - } else { - // Descend into the right subtree. We leave behind the left subtree and - // the current node, adjust the |rank| accordingly. - rank -= left_subtree_num_nodes + 1; - node = RightOf(node); - } - } - - assert(0); - return false; -} - -uint32_t MoveToFront::CreateNode(uint32_t timestamp, uint32_t value) { - uint32_t handle = static_cast(nodes_.size()); - const auto result = value_to_node_.emplace(value, handle); - if (result.second) { - // Create new node. - nodes_.emplace_back(Node()); - Node& node = nodes_.back(); - node.timestamp = timestamp; - node.value = value; - node.size = 1; - // Non-NIL nodes start with height 1 because their NIL children are - // leaves. - node.height = 1; - } else { - // Reuse old node. - handle = result.first->second; - assert(!IsInTree(handle)); - assert(ValueOf(handle) == value); - assert(SizeOf(handle) == 1); - assert(HeightOf(handle) == 1); - MutableTimestampOf(handle) = timestamp; - } - - return handle; -} - -void MoveToFront::InsertNode(uint32_t node) { - assert(!IsInTree(node)); - assert(SizeOf(node) == 1); - assert(HeightOf(node) == 1); - assert(TimestampOf(node)); - - if (!root_) { - root_ = node; - return; - } - - uint32_t iter = root_; - uint32_t parent = 0; - - // Will determine if |node| will become the right or left child after - // insertion (but before balancing). - bool right_child = true; - - // Find the node which will become |node|'s parent after insertion - // (but before balancing). - while (iter) { - parent = iter; - assert(TimestampOf(iter) != TimestampOf(node)); - right_child = TimestampOf(iter) > TimestampOf(node); - iter = right_child ? RightOf(iter) : LeftOf(iter); - } - - assert(parent); - - // Connect node and parent. - MutableParentOf(node) = parent; - if (right_child) - MutableRightOf(parent) = node; - else - MutableLeftOf(parent) = node; - - // Insertion is finished. Start the balancing process. - bool needs_rebalancing = true; - parent = ParentOf(node); - - while (parent) { - UpdateNode(parent); - - if (needs_rebalancing) { - const int parent_balance = BalanceOf(parent); - - if (RightOf(parent) == node) { - // Added node to the right subtree. - if (parent_balance > 1) { - // Parent is right heavy, rotate left. - if (BalanceOf(node) < 0) RotateRight(node); - parent = RotateLeft(parent); - } else if (parent_balance == 0 || parent_balance == -1) { - // Parent is balanced or left heavy, no need to balance further. - needs_rebalancing = false; - } - } else { - // Added node to the left subtree. - if (parent_balance < -1) { - // Parent is left heavy, rotate right. - if (BalanceOf(node) > 0) RotateLeft(node); - parent = RotateRight(parent); - } else if (parent_balance == 0 || parent_balance == 1) { - // Parent is balanced or right heavy, no need to balance further. - needs_rebalancing = false; - } - } - } - - assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); - - node = parent; - parent = ParentOf(parent); - } -} - -uint32_t MoveToFront::RemoveNode(uint32_t node) { - if (LeftOf(node) && RightOf(node)) { - // If |node| has two children, then use another node as scapegoat and swap - // their contents. We pick the scapegoat on the side of the tree which has - // more nodes. - const uint32_t scapegoat = SizeOf(LeftOf(node)) >= SizeOf(RightOf(node)) - ? RightestDescendantOf(LeftOf(node)) - : LeftestDescendantOf(RightOf(node)); - assert(scapegoat); - std::swap(MutableValueOf(node), MutableValueOf(scapegoat)); - std::swap(MutableTimestampOf(node), MutableTimestampOf(scapegoat)); - value_to_node_[ValueOf(node)] = node; - value_to_node_[ValueOf(scapegoat)] = scapegoat; - node = scapegoat; - } - - // |node| may have only one child at this point. - assert(!RightOf(node) || !LeftOf(node)); - - uint32_t parent = ParentOf(node); - uint32_t child = RightOf(node) ? RightOf(node) : LeftOf(node); - - // Orphan |node| and reconnect parent and child. - if (child) MutableParentOf(child) = parent; - - if (parent) { - if (LeftOf(parent) == node) - MutableLeftOf(parent) = child; - else - MutableRightOf(parent) = child; - } - - MutableParentOf(node) = 0; - MutableLeftOf(node) = 0; - MutableRightOf(node) = 0; - UpdateNode(node); - const uint32_t orphan = node; - - if (root_ == node) root_ = child; - - // Removal is finished. Start the balancing process. - bool needs_rebalancing = true; - node = child; - - while (parent) { - UpdateNode(parent); - - if (needs_rebalancing) { - const int parent_balance = BalanceOf(parent); - - if (parent_balance == 1 || parent_balance == -1) { - // The height of the subtree was not changed. - needs_rebalancing = false; - } else { - if (RightOf(parent) == node) { - // Removed node from the right subtree. - if (parent_balance < -1) { - // Parent is left heavy, rotate right. - const uint32_t sibling = LeftOf(parent); - if (BalanceOf(sibling) > 0) RotateLeft(sibling); - parent = RotateRight(parent); - } - } else { - // Removed node from the left subtree. - if (parent_balance > 1) { - // Parent is right heavy, rotate left. - const uint32_t sibling = RightOf(parent); - if (BalanceOf(sibling) < 0) RotateRight(sibling); - parent = RotateLeft(parent); - } - } - } - } - - assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); - - node = parent; - parent = ParentOf(parent); - } - - return orphan; -} - -uint32_t MoveToFront::RotateLeft(const uint32_t node) { - const uint32_t pivot = RightOf(node); - assert(pivot); - - // LeftOf(pivot) gets attached to node in place of pivot. - MutableRightOf(node) = LeftOf(pivot); - if (RightOf(node)) MutableParentOf(RightOf(node)) = node; - - // Pivot gets attached to ParentOf(node) in place of node. - MutableParentOf(pivot) = ParentOf(node); - if (!ParentOf(node)) - root_ = pivot; - else if (IsLeftChild(node)) - MutableLeftOf(ParentOf(node)) = pivot; - else - MutableRightOf(ParentOf(node)) = pivot; - - // Node is child of pivot. - MutableLeftOf(pivot) = node; - MutableParentOf(node) = pivot; - - // Update both node and pivot. Pivot is the new parent of node, so node should - // be updated first. - UpdateNode(node); - UpdateNode(pivot); - - return pivot; -} - -uint32_t MoveToFront::RotateRight(const uint32_t node) { - const uint32_t pivot = LeftOf(node); - assert(pivot); - - // RightOf(pivot) gets attached to node in place of pivot. - MutableLeftOf(node) = RightOf(pivot); - if (LeftOf(node)) MutableParentOf(LeftOf(node)) = node; - - // Pivot gets attached to ParentOf(node) in place of node. - MutableParentOf(pivot) = ParentOf(node); - if (!ParentOf(node)) - root_ = pivot; - else if (IsLeftChild(node)) - MutableLeftOf(ParentOf(node)) = pivot; - else - MutableRightOf(ParentOf(node)) = pivot; - - // Node is child of pivot. - MutableRightOf(pivot) = node; - MutableParentOf(node) = pivot; - - // Update both node and pivot. Pivot is the new parent of node, so node should - // be updated first. - UpdateNode(node); - UpdateNode(pivot); - - return pivot; -} - -void MoveToFront::UpdateNode(uint32_t node) { - MutableSizeOf(node) = 1 + SizeOf(LeftOf(node)) + SizeOf(RightOf(node)); - MutableHeightOf(node) = - 1 + std::max(HeightOf(LeftOf(node)), HeightOf(RightOf(node))); -} - -} // namespace comp -} // namespace spvtools diff --git a/source/comp/move_to_front.h b/source/comp/move_to_front.h deleted file mode 100644 index 8752194ec..000000000 --- a/source/comp/move_to_front.h +++ /dev/null @@ -1,384 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SOURCE_COMP_MOVE_TO_FRONT_H_ -#define SOURCE_COMP_MOVE_TO_FRONT_H_ - -#include -#include -#include -#include -#include -#include - -namespace spvtools { -namespace comp { - -// Log(n) move-to-front implementation. Implements the following functions: -// Insert - pushes value to the front of the mtf sequence -// (only unique values allowed). -// Remove - remove value from the sequence. -// ValueFromRank - access value by its 1-indexed rank in the sequence. -// RankFromValue - get the rank of the given value in the sequence. -// Accessing a value with ValueFromRank or RankFromValue moves the value to the -// front of the sequence (rank of 1). -// -// The implementation is based on an AVL-based order statistic tree. The tree -// is ordered by timestamps issued when values are inserted or accessed (recent -// values go to the left side of the tree, old values are gradually rotated to -// the right side). -// -// Terminology -// rank: 1-indexed rank showing how recently the value was inserted or accessed. -// node: handle used internally to access node data. -// size: size of the subtree of a node (including the node). -// height: distance from a node to the farthest leaf. -class MoveToFront { - public: - explicit MoveToFront(size_t reserve_capacity = 4) { - nodes_.reserve(reserve_capacity); - - // Create NIL node. - nodes_.emplace_back(Node()); - } - - virtual ~MoveToFront() = default; - - // Inserts value in the move-to-front sequence. Does nothing if the value is - // already in the sequence. Returns true if insertion was successful. - // The inserted value is placed at the front of the sequence (rank 1). - bool Insert(uint32_t value); - - // Removes value from move-to-front sequence. Returns false iff the value - // was not found. - bool Remove(uint32_t value); - - // Computes 1-indexed rank of value in the move-to-front sequence and moves - // the value to the front. Example: - // Before the call: 4 8 2 1 7 - // RankFromValue(8) returns 2 - // After the call: 8 4 2 1 7 - // Returns true iff the value was found in the sequence. - bool RankFromValue(uint32_t value, uint32_t* rank); - - // Returns value corresponding to a 1-indexed rank in the move-to-front - // sequence and moves the value to the front. Example: - // Before the call: 4 8 2 1 7 - // ValueFromRank(2) returns 8 - // After the call: 8 4 2 1 7 - // Returns true iff the rank is within bounds [1, GetSize()]. - bool ValueFromRank(uint32_t rank, uint32_t* value); - - // Moves the value to the front of the sequence. - // Returns false iff value is not in the sequence. - bool Promote(uint32_t value); - - // Returns true iff the move-to-front sequence contains the value. - bool HasValue(uint32_t value) const; - - // Returns the number of elements in the move-to-front sequence. - uint32_t GetSize() const { return SizeOf(root_); } - - protected: - // Internal tree data structure uses handles instead of pointers. Leaves and - // root parent reference a singleton under handle 0. Although dereferencing - // a null pointer is not possible, inappropriate access to handle 0 would - // cause an assertion. Handles are not garbage collected if value was - // deprecated - // with DeprecateValue(). But handles are recycled when a node is - // repositioned. - - // Internal tree data structure node. - struct Node { - // Timestamp from a logical clock which updates every time the element is - // accessed through ValueFromRank or RankFromValue. - uint32_t timestamp = 0; - // The size of the node's subtree, including the node. - // SizeOf(LeftOf(node)) + SizeOf(RightOf(node)) + 1. - uint32_t size = 0; - // Handles to connected nodes. - uint32_t left = 0; - uint32_t right = 0; - uint32_t parent = 0; - // Distance to the farthest leaf. - // Leaves have height 0, real nodes at least 1. - uint32_t height = 0; - // Stored value. - uint32_t value = 0; - }; - - // Creates node and sets correct values. Non-NIL nodes should be created only - // through this function. If the node with this value has been created - // previously - // and since orphaned, reuses the old node instead of creating a new one. - uint32_t CreateNode(uint32_t timestamp, uint32_t value); - - // Node accessor methods. Naming is designed to be similar to natural - // language as these functions tend to be used in sequences, for example: - // ParentOf(LeftestDescendentOf(RightOf(node))) - - // Returns value of the node referenced by |handle|. - uint32_t ValueOf(uint32_t node) const { return nodes_.at(node).value; } - - // Returns left child of |node|. - uint32_t LeftOf(uint32_t node) const { return nodes_.at(node).left; } - - // Returns right child of |node|. - uint32_t RightOf(uint32_t node) const { return nodes_.at(node).right; } - - // Returns parent of |node|. - uint32_t ParentOf(uint32_t node) const { return nodes_.at(node).parent; } - - // Returns timestamp of |node|. - uint32_t TimestampOf(uint32_t node) const { - assert(node); - return nodes_.at(node).timestamp; - } - - // Returns size of |node|. - uint32_t SizeOf(uint32_t node) const { return nodes_.at(node).size; } - - // Returns height of |node|. - uint32_t HeightOf(uint32_t node) const { return nodes_.at(node).height; } - - // Returns mutable reference to value of |node|. - uint32_t& MutableValueOf(uint32_t node) { - assert(node); - return nodes_.at(node).value; - } - - // Returns mutable reference to handle of left child of |node|. - uint32_t& MutableLeftOf(uint32_t node) { - assert(node); - return nodes_.at(node).left; - } - - // Returns mutable reference to handle of right child of |node|. - uint32_t& MutableRightOf(uint32_t node) { - assert(node); - return nodes_.at(node).right; - } - - // Returns mutable reference to handle of parent of |node|. - uint32_t& MutableParentOf(uint32_t node) { - assert(node); - return nodes_.at(node).parent; - } - - // Returns mutable reference to timestamp of |node|. - uint32_t& MutableTimestampOf(uint32_t node) { - assert(node); - return nodes_.at(node).timestamp; - } - - // Returns mutable reference to size of |node|. - uint32_t& MutableSizeOf(uint32_t node) { - assert(node); - return nodes_.at(node).size; - } - - // Returns mutable reference to height of |node|. - uint32_t& MutableHeightOf(uint32_t node) { - assert(node); - return nodes_.at(node).height; - } - - // Returns true iff |node| is left child of its parent. - bool IsLeftChild(uint32_t node) const { - assert(node); - return LeftOf(ParentOf(node)) == node; - } - - // Returns true iff |node| is right child of its parent. - bool IsRightChild(uint32_t node) const { - assert(node); - return RightOf(ParentOf(node)) == node; - } - - // Returns true iff |node| has no relatives. - bool IsOrphan(uint32_t node) const { - assert(node); - return !ParentOf(node) && !LeftOf(node) && !RightOf(node); - } - - // Returns true iff |node| is in the tree. - bool IsInTree(uint32_t node) const { - assert(node); - return node == root_ || !IsOrphan(node); - } - - // Returns the height difference between right and left subtrees. - int BalanceOf(uint32_t node) const { - return int(HeightOf(RightOf(node))) - int(HeightOf(LeftOf(node))); - } - - // Updates size and height of the node, assuming that the children have - // correct values. - void UpdateNode(uint32_t node); - - // Returns the most LeftOf(LeftOf(... descendent which is not leaf. - uint32_t LeftestDescendantOf(uint32_t node) const { - uint32_t parent = 0; - while (node) { - parent = node; - node = LeftOf(node); - } - return parent; - } - - // Returns the most RightOf(RightOf(... descendent which is not leaf. - uint32_t RightestDescendantOf(uint32_t node) const { - uint32_t parent = 0; - while (node) { - parent = node; - node = RightOf(node); - } - return parent; - } - - // Inserts node in the tree. The node must be an orphan. - void InsertNode(uint32_t node); - - // Removes node from the tree. May change value_to_node_ if removal uses a - // scapegoat. Returns the removed (orphaned) handle for recycling. The - // returned handle may not be equal to |node| if scapegoat was used. - uint32_t RemoveNode(uint32_t node); - - // Rotates |node| left, reassigns all connections and returns the node - // which takes place of the |node|. - uint32_t RotateLeft(const uint32_t node); - - // Rotates |node| right, reassigns all connections and returns the node - // which takes place of the |node|. - uint32_t RotateRight(const uint32_t node); - - // Root node handle. The tree is empty if root_ is 0. - uint32_t root_ = 0; - - // Incremented counters for next timestamp and value. - uint32_t next_timestamp_ = 1; - - // Holds all tree nodes. Indices of this vector are node handles. - std::vector nodes_; - - // Maps ids to node handles. - std::unordered_map value_to_node_; - - // Cache for the last accessed value in the sequence. - uint32_t last_accessed_value_ = 0; - bool last_accessed_value_valid_ = false; -}; - -class MultiMoveToFront { - public: - // Inserts |value| to sequence with handle |mtf|. - // Returns false if |mtf| already has |value|. - bool Insert(uint64_t mtf, uint32_t value) { - if (GetMtf(mtf).Insert(value)) { - val_to_mtfs_[value].insert(mtf); - return true; - } - return false; - } - - // Removes |value| from sequence with handle |mtf|. - // Returns false if |mtf| doesn't have |value|. - bool Remove(uint64_t mtf, uint32_t value) { - if (GetMtf(mtf).Remove(value)) { - val_to_mtfs_[value].erase(mtf); - return true; - } - assert(val_to_mtfs_[value].count(mtf) == 0); - return false; - } - - // Removes |value| from all sequences which have it. - void RemoveFromAll(uint32_t value) { - auto it = val_to_mtfs_.find(value); - if (it == val_to_mtfs_.end()) return; - - auto& mtfs_containing_value = it->second; - for (uint64_t mtf : mtfs_containing_value) { - GetMtf(mtf).Remove(value); - } - - val_to_mtfs_.erase(value); - } - - // Computes rank of |value| in sequence |mtf|. - // Returns false if |mtf| doesn't have |value|. - bool RankFromValue(uint64_t mtf, uint32_t value, uint32_t* rank) { - return GetMtf(mtf).RankFromValue(value, rank); - } - - // Finds |value| with |rank| in sequence |mtf|. - // Returns false if |rank| is out of bounds. - bool ValueFromRank(uint64_t mtf, uint32_t rank, uint32_t* value) { - return GetMtf(mtf).ValueFromRank(rank, value); - } - - // Returns size of |mtf| sequence. - uint32_t GetSize(uint64_t mtf) { return GetMtf(mtf).GetSize(); } - - // Promotes |value| in all sequences which have it. - void Promote(uint32_t value) { - const auto it = val_to_mtfs_.find(value); - if (it == val_to_mtfs_.end()) return; - - const auto& mtfs_containing_value = it->second; - for (uint64_t mtf : mtfs_containing_value) { - GetMtf(mtf).Promote(value); - } - } - - // Inserts |value| in sequence |mtf| or promotes if it's already there. - void InsertOrPromote(uint64_t mtf, uint32_t value) { - if (!Insert(mtf, value)) { - GetMtf(mtf).Promote(value); - } - } - - // Returns if |mtf| sequence has |value|. - bool HasValue(uint64_t mtf, uint32_t value) { - return GetMtf(mtf).HasValue(value); - } - - private: - // Returns actual MoveToFront object corresponding to |handle|. - // As multiple operations are often performed consecutively for the same - // sequence, the last returned value is cached. - MoveToFront& GetMtf(uint64_t handle) { - if (!cached_mtf_ || cached_handle_ != handle) { - cached_handle_ = handle; - cached_mtf_ = &mtfs_[handle]; - } - - return *cached_mtf_; - } - - // Container holding MoveToFront objects. Map key is sequence handle. - std::map mtfs_; - - // Container mapping value to sequences which contain that value. - std::unordered_map> val_to_mtfs_; - - // Cache for the last accessed sequence. - uint64_t cached_handle_ = 0; - MoveToFront* cached_mtf_ = nullptr; -}; - -} // namespace comp -} // namespace spvtools - -#endif // SOURCE_COMP_MOVE_TO_FRONT_H_ diff --git a/source/id_descriptor.cpp b/source/id_descriptor.cpp deleted file mode 100644 index d44ed672c..000000000 --- a/source/id_descriptor.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "source/id_descriptor.h" - -#include -#include - -#include "source/opcode.h" -#include "source/operand.h" - -namespace spvtools { -namespace { - -// Hashes an array of words. Order of words is important. -uint32_t HashU32Array(const std::vector& words) { - // The hash function is a sum of hashes of each word seeded by word index. - // Knuth's multiplicative hash is used to hash the words. - const uint32_t kKnuthMulHash = 2654435761; - uint32_t val = 0; - for (uint32_t i = 0; i < words.size(); ++i) { - val += (words[i] + i + 123) * kKnuthMulHash; - } - return val; -} - -} // namespace - -uint32_t IdDescriptorCollection::ProcessInstruction( - const spv_parsed_instruction_t& inst) { - if (!inst.result_id) return 0; - - assert(words_.empty()); - words_.push_back(inst.words[0]); - - for (size_t operand_index = 0; operand_index < inst.num_operands; - ++operand_index) { - const auto& operand = inst.operands[operand_index]; - if (spvIsIdType(operand.type)) { - const uint32_t id = inst.words[operand.offset]; - const auto it = id_to_descriptor_.find(id); - // Forward declared ids are not hashed. - if (it != id_to_descriptor_.end()) { - words_.push_back(it->second); - } - } else { - for (size_t operand_word_index = 0; - operand_word_index < operand.num_words; ++operand_word_index) { - words_.push_back(inst.words[operand.offset + operand_word_index]); - } - } - } - - uint32_t descriptor = - custom_hash_func_ ? custom_hash_func_(words_) : HashU32Array(words_); - if (descriptor == 0) descriptor = 1; - assert(descriptor); - - words_.clear(); - - const auto result = id_to_descriptor_.emplace(inst.result_id, descriptor); - assert(result.second); - (void)result; - return descriptor; -} - -} // namespace spvtools diff --git a/source/id_descriptor.h b/source/id_descriptor.h deleted file mode 100644 index add23343a..000000000 --- a/source/id_descriptor.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SOURCE_ID_DESCRIPTOR_H_ -#define SOURCE_ID_DESCRIPTOR_H_ - -#include -#include - -#include "spirv-tools/libspirv.hpp" - -namespace spvtools { - -using CustomHashFunc = std::function&)>; - -// Computes and stores id descriptors. -// -// Descriptors are computed as hash of all words in the instruction where ids -// were substituted with previously computed descriptors. -class IdDescriptorCollection { - public: - explicit IdDescriptorCollection( - CustomHashFunc custom_hash_func = CustomHashFunc()) - : custom_hash_func_(custom_hash_func) { - words_.reserve(16); - } - - // Computes descriptor for the result id of the given instruction and - // registers it in id_to_descriptor_. Returns the computed descriptor. - // This function needs to be sequentially called for every instruction in the - // module. - uint32_t ProcessInstruction(const spv_parsed_instruction_t& inst); - - // Returns a previously computed descriptor id. - uint32_t GetDescriptor(uint32_t id) const { - const auto it = id_to_descriptor_.find(id); - if (it == id_to_descriptor_.end()) return 0; - return it->second; - } - - private: - std::unordered_map id_to_descriptor_; - - std::function&)> custom_hash_func_; - - // Scratch buffer used for hashing. Class member to optimize on allocation. - std::vector words_; -}; - -} // namespace spvtools - -#endif // SOURCE_ID_DESCRIPTOR_H_ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bf0792cfc..5def389d8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -183,33 +183,9 @@ add_spvtools_unittest( endif() -add_spvtools_unittest( - TARGET bit_stream - SRCS bit_stream.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.h - LIBS ${SPIRV_TOOLS}) - -add_spvtools_unittest( - TARGET huffman_codec - SRCS huffman_codec.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.h - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/huffman_codec.h - LIBS ${SPIRV_TOOLS}) - -add_spvtools_unittest( - TARGET move_to_front - SRCS move_to_front_test.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/move_to_front.h - ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/move_to_front.cpp - LIBS ${SPIRV_TOOLS}) - -add_subdirectory(comp) add_subdirectory(link) add_subdirectory(opt) add_subdirectory(reduce) -add_subdirectory(stats) add_subdirectory(tools) add_subdirectory(util) add_subdirectory(val) diff --git a/test/bit_stream.cpp b/test/bit_stream.cpp deleted file mode 100644 index f02faf3c6..000000000 --- a/test/bit_stream.cpp +++ /dev/null @@ -1,1025 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include - -#include "gmock/gmock.h" -#include "source/comp/bit_stream.h" - -namespace spvtools { -namespace comp { -namespace { - -// Converts |buffer| to a stream of '0' and '1'. -template -std::string BufferToStream(const std::vector& buffer) { - std::stringstream ss; - for (auto it = buffer.begin(); it != buffer.end(); ++it) { - std::string str = std::bitset(*it).to_string(); - // Strings generated by std::bitset::to_string are read right to left. - // Reversing to left to right. - std::reverse(str.begin(), str.end()); - ss << str; - } - return ss.str(); -} - -// Converts a left-to-right input string of '0' and '1' to a buffer of |T| -// words. -template -std::vector StreamToBuffer(std::string str) { - // The input string is left-to-right, the input argument of std::bitset needs - // to right-to-left. Instead of reversing tokens, reverse the entire string - // and iterate tokens from end to begin. - std::reverse(str.begin(), str.end()); - const int word_size = static_cast(sizeof(T) * 8); - const int str_length = static_cast(str.length()); - std::vector buffer; - buffer.reserve(NumBitsToNumWords(str.length())); - for (int index = str_length - word_size; index >= 0; index -= word_size) { - buffer.push_back(static_cast( - std::bitset(str, index, word_size).to_ullong())); - } - const size_t suffix_length = str.length() % word_size; - if (suffix_length != 0) { - buffer.push_back(static_cast( - std::bitset(str, 0, suffix_length).to_ullong())); - } - return buffer; -} - -// Adds '0' chars at the end of the string until the size is a multiple of N. -template -std::string PadToWord(std::string&& str) { - const size_t tail_length = str.size() % N; - if (tail_length != 0) str += std::string(N - tail_length, '0'); - return std::move(str); -} - -// Adds '0' chars at the end of the string until the size is a multiple of N. -template -std::string PadToWord(const std::string& str) { - return PadToWord(std::string(str)); -} - -// Converts a left-to-right stream of bits to std::bitset. -template -std::bitset StreamToBitset(std::string str) { - std::reverse(str.begin(), str.end()); - return std::bitset(str); -} - -// Converts a left-to-right stream of bits to uint64. -uint64_t StreamToBits(std::string str) { - std::reverse(str.begin(), str.end()); - return std::bitset<64>(str).to_ullong(); -} - -// A simple and inefficient implementatition of BitWriterInterface, -// using std::stringstream. Intended for tests only. -class BitWriterStringStream : public BitWriterInterface { - public: - void WriteBits(uint64_t bits, size_t num_bits) override { - assert(num_bits <= 64); - ss_ << BitsToStream(bits, num_bits); - } - - size_t GetNumBits() const override { return ss_.str().size(); } - - std::vector GetDataCopy() const override { - return StreamToBuffer(ss_.str()); - } - - std::string GetStreamRaw() const { return ss_.str(); } - - private: - std::stringstream ss_; -}; - -// A simple and inefficient implementatition of BitReaderInterface. -// Intended for tests only. -class BitReaderFromString : public BitReaderInterface { - public: - explicit BitReaderFromString(std::string&& str) - : str_(std::move(str)), pos_(0) {} - - explicit BitReaderFromString(const std::vector& buffer) - : str_(BufferToStream(buffer)), pos_(0) {} - - explicit BitReaderFromString(const std::vector& buffer) - : str_(PadToWord<64>(BufferToStream(buffer))), pos_(0) {} - - size_t ReadBits(uint64_t* bits, size_t num_bits) override { - if (ReachedEnd()) return 0; - std::string sub = str_.substr(pos_, num_bits); - *bits = StreamToBits(sub); - pos_ += sub.length(); - return sub.length(); - } - - size_t GetNumReadBits() const override { return pos_; } - - bool ReachedEnd() const override { return pos_ >= str_.length(); } - - private: - std::string str_; - size_t pos_; -}; - -TEST(NumBitsToNumWords, Word8) { - EXPECT_EQ(0u, NumBitsToNumWords<8>(0)); - EXPECT_EQ(1u, NumBitsToNumWords<8>(1)); - EXPECT_EQ(1u, NumBitsToNumWords<8>(7)); - EXPECT_EQ(1u, NumBitsToNumWords<8>(8)); - EXPECT_EQ(2u, NumBitsToNumWords<8>(9)); - EXPECT_EQ(2u, NumBitsToNumWords<8>(16)); - EXPECT_EQ(3u, NumBitsToNumWords<8>(17)); - EXPECT_EQ(3u, NumBitsToNumWords<8>(23)); - EXPECT_EQ(3u, NumBitsToNumWords<8>(24)); - EXPECT_EQ(4u, NumBitsToNumWords<8>(25)); -} - -TEST(NumBitsToNumWords, Word64) { - EXPECT_EQ(0u, NumBitsToNumWords<64>(0)); - EXPECT_EQ(1u, NumBitsToNumWords<64>(1)); - EXPECT_EQ(1u, NumBitsToNumWords<64>(64)); - EXPECT_EQ(2u, NumBitsToNumWords<64>(65)); - EXPECT_EQ(2u, NumBitsToNumWords<64>(128)); - EXPECT_EQ(3u, NumBitsToNumWords<64>(129)); -} - -TEST(ZigZagCoding, Encode0) { - EXPECT_EQ(0u, EncodeZigZag(0, 0)); - EXPECT_EQ(1u, EncodeZigZag(-1, 0)); - EXPECT_EQ(2u, EncodeZigZag(1, 0)); - EXPECT_EQ(3u, EncodeZigZag(-2, 0)); - EXPECT_EQ(std::numeric_limits::max() - 1, - EncodeZigZag(std::numeric_limits::max(), 0)); - EXPECT_EQ(std::numeric_limits::max(), - EncodeZigZag(std::numeric_limits::min(), 0)); -} - -TEST(ZigZagCoding, Decode0) { - EXPECT_EQ(0, DecodeZigZag(0, 0)); - EXPECT_EQ(-1, DecodeZigZag(1, 0)); - EXPECT_EQ(1, DecodeZigZag(2, 0)); - EXPECT_EQ(-2, DecodeZigZag(3, 0)); - EXPECT_EQ(std::numeric_limits::min(), - DecodeZigZag(std::numeric_limits::max(), 0)); - EXPECT_EQ(std::numeric_limits::max(), - DecodeZigZag(std::numeric_limits::max() - 1, 0)); -} - -TEST(ZigZagCoding, Encode1) { - EXPECT_EQ(0u, EncodeZigZag(0, 1)); - EXPECT_EQ(1u, EncodeZigZag(1, 1)); - EXPECT_EQ(2u, EncodeZigZag(-1, 1)); - EXPECT_EQ(3u, EncodeZigZag(-2, 1)); - EXPECT_EQ(4u, EncodeZigZag(2, 1)); - EXPECT_EQ(5u, EncodeZigZag(3, 1)); - EXPECT_EQ(6u, EncodeZigZag(-3, 1)); - EXPECT_EQ(7u, EncodeZigZag(-4, 1)); - EXPECT_EQ(std::numeric_limits::max() - 2, - EncodeZigZag(std::numeric_limits::max(), 1)); - EXPECT_EQ(std::numeric_limits::max() - 1, - EncodeZigZag(std::numeric_limits::min() + 1, 1)); - EXPECT_EQ(std::numeric_limits::max(), - EncodeZigZag(std::numeric_limits::min(), 1)); -} - -TEST(ZigZagCoding, Decode1) { - EXPECT_EQ(0, DecodeZigZag(0, 1)); - EXPECT_EQ(1, DecodeZigZag(1, 1)); - EXPECT_EQ(-1, DecodeZigZag(2, 1)); - EXPECT_EQ(-2, DecodeZigZag(3, 1)); - EXPECT_EQ(2, DecodeZigZag(4, 1)); - EXPECT_EQ(3, DecodeZigZag(5, 1)); - EXPECT_EQ(-3, DecodeZigZag(6, 1)); - EXPECT_EQ(-4, DecodeZigZag(7, 1)); - EXPECT_EQ(std::numeric_limits::min(), - DecodeZigZag(std::numeric_limits::max(), 1)); - EXPECT_EQ(std::numeric_limits::min() + 1, - DecodeZigZag(std::numeric_limits::max() - 1, 1)); - EXPECT_EQ(std::numeric_limits::max(), - DecodeZigZag(std::numeric_limits::max() - 2, 1)); -} - -TEST(ZigZagCoding, Encode2) { - EXPECT_EQ(0u, EncodeZigZag(0, 2)); - EXPECT_EQ(1u, EncodeZigZag(1, 2)); - EXPECT_EQ(2u, EncodeZigZag(2, 2)); - EXPECT_EQ(3u, EncodeZigZag(3, 2)); - EXPECT_EQ(4u, EncodeZigZag(-1, 2)); - EXPECT_EQ(5u, EncodeZigZag(-2, 2)); - EXPECT_EQ(6u, EncodeZigZag(-3, 2)); - EXPECT_EQ(7u, EncodeZigZag(-4, 2)); - EXPECT_EQ(8u, EncodeZigZag(4, 2)); - EXPECT_EQ(9u, EncodeZigZag(5, 2)); - EXPECT_EQ(10u, EncodeZigZag(6, 2)); - EXPECT_EQ(11u, EncodeZigZag(7, 2)); - EXPECT_EQ(12u, EncodeZigZag(-5, 2)); - EXPECT_EQ(13u, EncodeZigZag(-6, 2)); - EXPECT_EQ(14u, EncodeZigZag(-7, 2)); - EXPECT_EQ(15u, EncodeZigZag(-8, 2)); - EXPECT_EQ(std::numeric_limits::max() - 4, - EncodeZigZag(std::numeric_limits::max(), 2)); - EXPECT_EQ(std::numeric_limits::max() - 3, - EncodeZigZag(std::numeric_limits::min() + 3, 2)); - EXPECT_EQ(std::numeric_limits::max() - 2, - EncodeZigZag(std::numeric_limits::min() + 2, 2)); - EXPECT_EQ(std::numeric_limits::max() - 1, - EncodeZigZag(std::numeric_limits::min() + 1, 2)); - EXPECT_EQ(std::numeric_limits::max(), - EncodeZigZag(std::numeric_limits::min(), 2)); -} - -TEST(ZigZagCoding, Decode2) { - EXPECT_EQ(0, DecodeZigZag(0, 2)); - EXPECT_EQ(1, DecodeZigZag(1, 2)); - EXPECT_EQ(2, DecodeZigZag(2, 2)); - EXPECT_EQ(3, DecodeZigZag(3, 2)); - EXPECT_EQ(-1, DecodeZigZag(4, 2)); - EXPECT_EQ(-2, DecodeZigZag(5, 2)); - EXPECT_EQ(-3, DecodeZigZag(6, 2)); - EXPECT_EQ(-4, DecodeZigZag(7, 2)); - EXPECT_EQ(4, DecodeZigZag(8, 2)); - EXPECT_EQ(5, DecodeZigZag(9, 2)); - EXPECT_EQ(6, DecodeZigZag(10, 2)); - EXPECT_EQ(7, DecodeZigZag(11, 2)); - EXPECT_EQ(-5, DecodeZigZag(12, 2)); - EXPECT_EQ(-6, DecodeZigZag(13, 2)); - EXPECT_EQ(-7, DecodeZigZag(14, 2)); - EXPECT_EQ(-8, DecodeZigZag(15, 2)); - EXPECT_EQ(std::numeric_limits::min(), - DecodeZigZag(std::numeric_limits::max(), 2)); - EXPECT_EQ(std::numeric_limits::min() + 1, - DecodeZigZag(std::numeric_limits::max() - 1, 2)); - EXPECT_EQ(std::numeric_limits::min() + 2, - DecodeZigZag(std::numeric_limits::max() - 2, 2)); - EXPECT_EQ(std::numeric_limits::min() + 3, - DecodeZigZag(std::numeric_limits::max() - 3, 2)); - EXPECT_EQ(std::numeric_limits::max(), - DecodeZigZag(std::numeric_limits::max() - 4, 2)); -} - -TEST(ZigZagCoding, Encode63) { - EXPECT_EQ(0u, EncodeZigZag(0, 63)); - - for (int64_t i = 0; i < 0xFFFFFFFF; i += 1234567) { - const int64_t positive_val = GetLowerBits(i * i * i + i * i, 63) | 1UL; - ASSERT_EQ(static_cast(positive_val), - EncodeZigZag(positive_val, 63)); - ASSERT_EQ((1ULL << 63) - 1 + positive_val, EncodeZigZag(-positive_val, 63)); - } - - EXPECT_EQ((1ULL << 63) - 1, - EncodeZigZag(std::numeric_limits::max(), 63)); - EXPECT_EQ(std::numeric_limits::max() - 1, - EncodeZigZag(std::numeric_limits::min() + 1, 63)); - EXPECT_EQ(std::numeric_limits::max(), - EncodeZigZag(std::numeric_limits::min(), 63)); -} - -TEST(BufToStream, UInt8_Empty) { - const std::string expected_bits = ""; - std::vector buffer = StreamToBuffer(expected_bits); - EXPECT_TRUE(buffer.empty()); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(expected_bits, result_bits); -} - -TEST(BufToStream, UInt8_OneWord) { - const std::string expected_bits = "00101100"; - std::vector buffer = StreamToBuffer(expected_bits); - EXPECT_EQ(std::vector({static_cast( - StreamToBitset<8>(expected_bits).to_ulong())}), - buffer); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(expected_bits, result_bits); -} - -TEST(BufToStream, UInt8_MultipleWords) { - const std::string expected_bits = - "00100010" - "01101010" - "01111101" - "00100010"; - std::vector buffer = StreamToBuffer(expected_bits); - EXPECT_EQ(std::vector({ - static_cast(StreamToBitset<8>("00100010").to_ulong()), - static_cast(StreamToBitset<8>("01101010").to_ulong()), - static_cast(StreamToBitset<8>("01111101").to_ulong()), - static_cast(StreamToBitset<8>("00100010").to_ulong()), - }), - buffer); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(expected_bits, result_bits); -} - -TEST(BufToStream, UInt64_Empty) { - const std::string expected_bits = ""; - std::vector buffer = StreamToBuffer(expected_bits); - EXPECT_TRUE(buffer.empty()); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(expected_bits, result_bits); -} - -TEST(BufToStream, UInt64_OneWord) { - const std::string expected_bits = - "0001000111101110011001101010101000100010110011000100010010001000"; - std::vector buffer = StreamToBuffer(expected_bits); - ASSERT_EQ(1u, buffer.size()); - EXPECT_EQ(0x1122334455667788u, buffer[0]); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(expected_bits, result_bits); -} - -TEST(BufToStream, UInt64_Unaligned) { - const std::string expected_bits = - "0010001001101010011111010010001001001010000111110010010010010101" - "0010001001101010011111111111111111111111"; - std::vector buffer = StreamToBuffer(expected_bits); - EXPECT_EQ(std::vector({ - StreamToBits(expected_bits.substr(0, 64)), - StreamToBits(expected_bits.substr(64, 64)), - }), - buffer); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(PadToWord<64>(expected_bits), result_bits); -} - -TEST(BufToStream, UInt64_MultipleWords) { - const std::string expected_bits = - "0010001001101010011111010010001001001010000111110010010010010101" - "0010001001101010011111111111111111111111000111110010010010010111" - "0000000000000000000000000000000000000000000000000010010011111111"; - std::vector buffer = StreamToBuffer(expected_bits); - EXPECT_EQ(std::vector({ - StreamToBits(expected_bits.substr(0, 64)), - StreamToBits(expected_bits.substr(64, 64)), - StreamToBits(expected_bits.substr(128, 64)), - }), - buffer); - const std::string result_bits = BufferToStream(buffer); - EXPECT_EQ(expected_bits, result_bits); -} - -TEST(PadToWord, Test) { - EXPECT_EQ("10100000", PadToWord<8>("101")); - EXPECT_EQ( - "10100000" - "00000000", - PadToWord<16>("101")); - EXPECT_EQ( - "10100000" - "00000000" - "00000000" - "00000000", - PadToWord<32>("101")); - EXPECT_EQ( - "10100000" - "00000000" - "00000000" - "00000000" - "00000000" - "00000000" - "00000000" - "00000000", - PadToWord<64>("101")); -} - -TEST(BitWriterStringStream, Empty) { - BitWriterStringStream writer; - EXPECT_EQ(0u, writer.GetNumBits()); - EXPECT_EQ(0u, writer.GetDataSizeBytes()); - EXPECT_EQ("", writer.GetStreamRaw()); -} - -TEST(BitWriterStringStream, WriteBits) { - BitWriterStringStream writer; - const uint64_t bits1 = 0x1 | 0x2 | 0x10; - writer.WriteBits(bits1, 5); - EXPECT_EQ(5u, writer.GetNumBits()); - EXPECT_EQ(1u, writer.GetDataSizeBytes()); - EXPECT_EQ("11001", writer.GetStreamRaw()); -} - -TEST(BitWriterStringStream, WriteUnencodedU8) { - BitWriterStringStream writer; - const uint8_t bits = 127; - writer.WriteUnencoded(bits); - EXPECT_EQ(8u, writer.GetNumBits()); - EXPECT_EQ("11111110", writer.GetStreamRaw()); -} - -TEST(BitWriterStringStream, WriteUnencodedS64) { - BitWriterStringStream writer; - const int64_t bits = std::numeric_limits::min() + 7; - writer.WriteUnencoded(bits); - EXPECT_EQ(64u, writer.GetNumBits()); - EXPECT_EQ("1110000000000000000000000000000000000000000000000000000000000001", - writer.GetStreamRaw()); -} - -TEST(BitWriterStringStream, WriteMultiple) { - BitWriterStringStream writer; - - std::string expected_result; - - const uint64_t b2_val = 0x4 | 0x2 | 0x40; - const std::string bits2 = BitsToStream(b2_val, 8); - writer.WriteBits(b2_val, 8); - - const uint64_t val = 0x1 | 0x2 | 0x10; - const std::string bits3 = BitsToStream(val, 8); - writer.WriteBits(val, 8); - - const std::string expected = bits2 + bits3; - - EXPECT_EQ(expected.length(), writer.GetNumBits()); - EXPECT_EQ(2u, writer.GetDataSizeBytes()); - EXPECT_EQ(expected, writer.GetStreamRaw()); - - EXPECT_EQ(PadToWord<8>(expected), BufferToStream(writer.GetDataCopy())); -} - -TEST(BitWriterWord64, Empty) { - BitWriterWord64 writer; - EXPECT_EQ(0u, writer.GetNumBits()); - EXPECT_EQ(0u, writer.GetDataSizeBytes()); -} - -TEST(BitWriterWord64, WriteBits) { - BitWriterWord64 writer; - const uint64_t bits1 = 0x1 | 0x2 | 0x10; - writer.WriteBits(bits1, 5); - writer.WriteBits(bits1, 5); - writer.WriteBits(bits1, 5); - EXPECT_EQ(15u, writer.GetNumBits()); - EXPECT_EQ(2u, writer.GetDataSizeBytes()); -} - -TEST(BitWriterWord64, WriteZeroBits) { - BitWriterWord64 writer; - writer.WriteBits(0, 0); - writer.WriteBits(1, 0); - EXPECT_EQ(0u, writer.GetNumBits()); - writer.WriteBits(1, 1); - writer.WriteBits(0, 0); - writer.WriteBits(0, 63); - EXPECT_EQ(64u, writer.GetNumBits()); - writer.WriteBits(0, 0); - writer.WriteBits(7, 3); - writer.WriteBits(0, 0); -} - -TEST(BitWriterWord64, ComparisonTestWriteLotsOfBits) { - BitWriterStringStream writer1; - BitWriterWord64 writer2(16384); - - for (uint64_t i = 0; i < 65000; i += 25) { - writer1.WriteBits(i, 16); - writer2.WriteBits(i, 16); - ASSERT_EQ(writer1.GetNumBits(), writer2.GetNumBits()); - } -} - -TEST(GetLowerBits, Test) { - EXPECT_EQ(0u, GetLowerBits(255, 0)); - EXPECT_EQ(1u, GetLowerBits(255, 1)); - EXPECT_EQ(3u, GetLowerBits(255, 2)); - EXPECT_EQ(7u, GetLowerBits(255, 3)); - EXPECT_EQ(15u, GetLowerBits(255, 4)); - EXPECT_EQ(31u, GetLowerBits(255, 5)); - EXPECT_EQ(63u, GetLowerBits(255, 6)); - EXPECT_EQ(127u, GetLowerBits(255, 7)); - EXPECT_EQ(255u, GetLowerBits(255, 8)); - EXPECT_EQ(0xFFu, GetLowerBits(0xFFFFFFFF, 8)); - EXPECT_EQ(0xFFFFu, GetLowerBits(0xFFFFFFFF, 16)); - EXPECT_EQ(0xFFFFFFu, GetLowerBits(0xFFFFFFFF, 24)); - EXPECT_EQ(0xFFFFFFu, GetLowerBits(0xFFFFFFFFFFFF, 24)); - EXPECT_EQ(0xFFFFFFFFFFFFFFFFu, - GetLowerBits(0xFFFFFFFFFFFFFFFFu, 64)); - EXPECT_EQ(StreamToBits("1010001110"), - GetLowerBits(StreamToBits("1010001110111101111111"), 10)); -} - -TEST(BitReaderFromString, FromU8) { - std::vector buffer = { - 0xAA, - 0xBB, - 0xCC, - 0xDD, - }; - - const std::string total_stream = - "01010101" - "11011101" - "00110011" - "10111011"; - - BitReaderFromString reader(buffer); - - uint64_t bits = 0; - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(PadToWord<64>("01"), BitsToStream(bits)); - EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); - EXPECT_EQ(PadToWord<64>("01010111011101001100"), BitsToStream(bits)); - EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); - EXPECT_EQ(PadToWord<64>("11101110110000000000"), BitsToStream(bits)); - EXPECT_EQ(22u, reader.ReadBits(&bits, 30)); - EXPECT_EQ(PadToWord<64>("0000000000000000000000"), BitsToStream(bits)); - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderFromString, FromU64) { - std::vector buffer = { - 0xAAAAAAAAAAAAAAAA, - 0xBBBBBBBBBBBBBBBB, - 0xCCCCCCCCCCCCCCCC, - 0xDDDDDDDDDDDDDDDD, - }; - - const std::string total_stream = - "0101010101010101010101010101010101010101010101010101010101010101" - "1101110111011101110111011101110111011101110111011101110111011101" - "0011001100110011001100110011001100110011001100110011001100110011" - "1011101110111011101110111011101110111011101110111011101110111011"; - - BitReaderFromString reader(buffer); - - uint64_t bits = 0; - size_t pos = 0; - size_t to_read = 5; - while (reader.ReadBits(&bits, to_read) > 0) { - EXPECT_EQ(BitsToStream(bits), - PadToWord<64>(total_stream.substr(pos, to_read))); - pos += to_read; - to_read = (to_read + 35) % 64 + 1; - } - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderWord64, ReadBitsSingleByte) { - BitReaderWord64 reader(std::vector({uint8_t(0xF0)})); - EXPECT_FALSE(reader.ReachedEnd()); - - uint64_t bits = 0; - EXPECT_EQ(1u, reader.ReadBits(&bits, 1)); - EXPECT_EQ(0u, bits); - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(0u, bits); - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(2u, bits); - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(3u, bits); - EXPECT_FALSE(reader.OnlyZeroesLeft()); - EXPECT_FALSE(reader.ReachedEnd()); - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(1u, bits); - EXPECT_TRUE(reader.OnlyZeroesLeft()); - EXPECT_FALSE(reader.ReachedEnd()); - EXPECT_EQ(55u, reader.ReadBits(&bits, 64)); - EXPECT_EQ(0u, bits); - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderWord64, ReadBitsTwoWords) { - std::vector buffer = {0x0000000000000001, 0x0000000000FFFFFF}; - - BitReaderWord64 reader(std::move(buffer)); - - uint64_t bits = 0; - EXPECT_EQ(1u, reader.ReadBits(&bits, 1)); - EXPECT_EQ(1u, bits); - EXPECT_EQ(62u, reader.ReadBits(&bits, 62)); - EXPECT_EQ(0u, bits); - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(2u, bits); - EXPECT_EQ(3u, reader.ReadBits(&bits, 3)); - EXPECT_EQ(7u, bits); - EXPECT_FALSE(reader.OnlyZeroesLeft()); - EXPECT_EQ(32u, reader.ReadBits(&bits, 32)); - EXPECT_EQ(0xFFFFFu, bits); - EXPECT_TRUE(reader.OnlyZeroesLeft()); - EXPECT_FALSE(reader.ReachedEnd()); - EXPECT_EQ(28u, reader.ReadBits(&bits, 32)); - EXPECT_EQ(0u, bits); - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderFromString, ReadUnencodedU8) { - BitReaderFromString reader("11111110"); - uint8_t val = 0; - ASSERT_TRUE(reader.ReadUnencoded(&val)); - EXPECT_EQ(8u, reader.GetNumReadBits()); - EXPECT_EQ(127, val); -} - -TEST(BitReaderFromString, ReadUnencodedU16Fail) { - BitReaderFromString reader("11111110"); - uint16_t val = 0; - ASSERT_FALSE(reader.ReadUnencoded(&val)); -} - -TEST(BitReaderFromString, ReadUnencodedS64) { - BitReaderFromString reader( - "1110000000000000000000000000000000000000000000000000000000000001"); - int64_t val = 0; - ASSERT_TRUE(reader.ReadUnencoded(&val)); - EXPECT_EQ(64u, reader.GetNumReadBits()); - EXPECT_EQ(std::numeric_limits::min() + 7, val); -} - -TEST(BitReaderWord64, FromU8) { - std::vector buffer = { - 0xAA, - 0xBB, - 0xCC, - 0xDD, - }; - - BitReaderWord64 reader(std::move(buffer)); - - uint64_t bits = 0; - EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); - EXPECT_EQ(PadToWord<64>("01"), BitsToStream(bits)); - EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); - EXPECT_EQ(PadToWord<64>("01010111011101001100"), BitsToStream(bits)); - EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); - EXPECT_EQ(PadToWord<64>("11101110110000000000"), BitsToStream(bits)); - EXPECT_EQ(22u, reader.ReadBits(&bits, 30)); - EXPECT_EQ(PadToWord<64>("0000000000000000000000"), BitsToStream(bits)); - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderWord64, FromU64) { - std::vector buffer = { - 0xAAAAAAAAAAAAAAAA, - 0xBBBBBBBBBBBBBBBB, - 0xCCCCCCCCCCCCCCCC, - 0xDDDDDDDDDDDDDDDD, - }; - - const std::string total_stream = - "0101010101010101010101010101010101010101010101010101010101010101" - "1101110111011101110111011101110111011101110111011101110111011101" - "0011001100110011001100110011001100110011001100110011001100110011" - "1011101110111011101110111011101110111011101110111011101110111011"; - - BitReaderWord64 reader(std::move(buffer)); - - uint64_t bits = 0; - size_t pos = 0; - size_t to_read = 5; - while (reader.ReadBits(&bits, to_read) > 0) { - EXPECT_EQ(BitsToStream(bits), - PadToWord<64>(total_stream.substr(pos, to_read))); - pos += to_read; - to_read = (to_read + 35) % 64 + 1; - } - EXPECT_TRUE(reader.ReachedEnd()); -} - -TEST(BitReaderWord64, ComparisonLotsOfU8) { - std::vector buffer; - for (uint32_t i = 0; i < 10003; ++i) { - buffer.push_back(static_cast(i % 255)); - } - - BitReaderFromString reader1(buffer); - BitReaderWord64 reader2(std::move(buffer)); - - uint64_t bits1 = 0, bits2 = 0; - size_t to_read = 5; - while (reader1.ReadBits(&bits1, to_read) > 0) { - reader2.ReadBits(&bits2, to_read); - EXPECT_EQ(bits1, bits2); - to_read = (to_read + 35) % 64 + 1; - } - - EXPECT_EQ(0u, reader2.ReadBits(&bits2, 1)); -} - -TEST(BitReaderWord64, ComparisonLotsOfU64) { - std::vector buffer; - for (uint64_t i = 0; i < 1000; ++i) { - buffer.push_back(i); - } - - BitReaderFromString reader1(buffer); - BitReaderWord64 reader2(std::move(buffer)); - - uint64_t bits1 = 0, bits2 = 0; - size_t to_read = 5; - while (reader1.ReadBits(&bits1, to_read) > 0) { - reader2.ReadBits(&bits2, to_read); - EXPECT_EQ(bits1, bits2); - to_read = (to_read + 35) % 64 + 1; - } - - EXPECT_EQ(0u, reader2.ReadBits(&bits2, 1)); -} - -TEST(ReadWriteWord64, ReadWriteLotsOfBits) { - BitWriterWord64 writer(16384); - for (uint64_t i = 0; i < 65000; i += 25) { - const uint64_t num_bits = i % 64 + 1; - const uint64_t bits = i >> (64 - num_bits); - writer.WriteBits(bits, size_t(num_bits)); - } - - BitReaderWord64 reader(writer.GetDataCopy()); - for (uint64_t i = 0; i < 65000; i += 25) { - const uint64_t num_bits = i % 64 + 1; - const uint64_t expected_bits = i >> (64 - num_bits); - uint64_t bits = 0; - reader.ReadBits(&bits, size_t(num_bits)); - EXPECT_EQ(expected_bits, bits); - } - - EXPECT_TRUE(reader.OnlyZeroesLeft()); -} - -TEST(VariableWidthWrite, Write0U) { - BitWriterStringStream writer; - writer.WriteVariableWidthU64(0, 2); - EXPECT_EQ("000", writer.GetStreamRaw()); - writer.WriteVariableWidthU32(0, 2); - EXPECT_EQ( - "000" - "000", - writer.GetStreamRaw()); - writer.WriteVariableWidthU16(0, 2); - EXPECT_EQ( - "000" - "000" - "000", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, WriteSmallUnsigned) { - BitWriterStringStream writer; - writer.WriteVariableWidthU64(1, 2); - EXPECT_EQ("100", writer.GetStreamRaw()); - writer.WriteVariableWidthU32(2, 2); - EXPECT_EQ( - "100" - "010", - writer.GetStreamRaw()); - writer.WriteVariableWidthU16(3, 2); - EXPECT_EQ( - "100" - "010" - "110", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, WriteSmallSigned) { - BitWriterStringStream writer; - writer.WriteVariableWidthS64(1, 2, 0); - EXPECT_EQ("010", writer.GetStreamRaw()); - writer.WriteVariableWidthS64(-1, 2, 0); - EXPECT_EQ( - "010" - "100", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, U64Val127ChunkLength7) { - BitWriterStringStream writer; - writer.WriteVariableWidthU64(127, 7); - EXPECT_EQ( - "1111111" - "0", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, U32Val255ChunkLength7) { - BitWriterStringStream writer; - writer.WriteVariableWidthU32(255, 7); - EXPECT_EQ( - "1111111" - "1" - "1000000" - "0", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, U16Val2ChunkLength4) { - BitWriterStringStream writer; - writer.WriteVariableWidthU16(2, 4); - EXPECT_EQ( - "0100" - "0", - writer.GetStreamRaw()); -} - -TEST(VariableWidthWrite, U64ValAAAAChunkLength2) { - BitWriterStringStream writer; - writer.WriteVariableWidthU64(0xAAAA, 2); - EXPECT_EQ( - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "0", - writer.GetStreamRaw()); -} - -TEST(VariableWidthRead, U64Val127ChunkLength7) { - BitReaderFromString reader( - "1111111" - "0"); - uint64_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 7)); - EXPECT_EQ(127u, val); -} - -TEST(VariableWidthRead, U32Val255ChunkLength7) { - BitReaderFromString reader( - "1111111" - "1" - "1000000" - "0"); - uint32_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU32(&val, 7)); - EXPECT_EQ(255u, val); -} - -TEST(VariableWidthRead, U16Val2ChunkLength4) { - BitReaderFromString reader( - "0100" - "0"); - uint16_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU16(&val, 4)); - EXPECT_EQ(2u, val); -} - -TEST(VariableWidthRead, U64ValAAAAChunkLength2) { - BitReaderFromString reader( - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "1" - "01" - "0"); - uint64_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 2)); - EXPECT_EQ(0xAAAAu, val); -} - -TEST(VariableWidthRead, FailTooShort) { - BitReaderFromString reader("00000001100000"); - uint64_t val = 0; - ASSERT_FALSE(reader.ReadVariableWidthU64(&val, 7)); -} - -TEST(VariableWidthWriteRead, SingleWriteReadU64) { - for (uint64_t i = 0; i < 1000000; i += 1234) { - const uint64_t val = i * i * i; - const size_t chunk_length = size_t(i % 16 + 1); - - BitWriterWord64 writer; - writer.WriteVariableWidthU64(val, chunk_length); - - BitReaderWord64 reader(writer.GetDataCopy()); - uint64_t read_val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU64(&read_val, chunk_length)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - -TEST(VariableWidthWriteRead, SingleWriteReadS64) { - for (int64_t i = 0; i < 1000000; i += 4321) { - const int64_t val = i * i * (i % 2 ? -i : i); - const size_t chunk_length = size_t(i % 16 + 1); - const size_t zigzag_exponent = size_t(i % 13); - - BitWriterWord64 writer; - writer.WriteVariableWidthS64(val, chunk_length, zigzag_exponent); - - BitReaderWord64 reader(writer.GetDataCopy()); - int64_t read_val = 0; - ASSERT_TRUE( - reader.ReadVariableWidthS64(&read_val, chunk_length, zigzag_exponent)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - -TEST(VariableWidthWriteRead, SingleWriteReadU32) { - for (uint32_t i = 0; i < 100000; i += 123) { - const uint32_t val = i * i; - const size_t chunk_length = i % 16 + 1; - - BitWriterWord64 writer; - writer.WriteVariableWidthU32(val, chunk_length); - - BitReaderWord64 reader(writer.GetDataCopy()); - uint32_t read_val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU32(&read_val, chunk_length)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - -TEST(VariableWidthWriteRead, SingleWriteReadU16) { - for (int i = 0; i < 65536; i += 123) { - const uint16_t val = static_cast(i); - const size_t chunk_length = val % 10 + 1; - - BitWriterWord64 writer; - writer.WriteVariableWidthU16(val, chunk_length); - - BitReaderWord64 reader(writer.GetDataCopy()); - uint16_t read_val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU16(&read_val, chunk_length)); - - ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; - } -} - -TEST(VariableWidthWriteRead, SmallNumbersChunkLength4) { - const std::vector expected_values = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - - BitWriterWord64 writer; - for (uint64_t val : expected_values) { - writer.WriteVariableWidthU64(val, 4); - } - - EXPECT_EQ(50u, writer.GetNumBits()); - - std::vector actual_values; - BitReaderWord64 reader(writer.GetDataCopy()); - while (!reader.OnlyZeroesLeft()) { - uint64_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 4)); - actual_values.push_back(val); - } - - EXPECT_EQ(expected_values, actual_values); -} - -TEST(VariableWidthWriteRead, VariedNumbersChunkLength8) { - const std::vector expected_values = {1000, 0, 255, 4294967296}; - const size_t kExpectedNumBits = 9 * (2 + 1 + 1 + 5); - - BitWriterWord64 writer; - for (uint64_t val : expected_values) { - writer.WriteVariableWidthU64(val, 8); - } - - EXPECT_EQ(kExpectedNumBits, writer.GetNumBits()); - - std::vector actual_values; - BitReaderWord64 reader(writer.GetDataCopy()); - while (!reader.OnlyZeroesLeft()) { - uint64_t val = 0; - ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 8)); - actual_values.push_back(val); - } - - EXPECT_EQ(expected_values, actual_values); -} - -} // namespace -} // namespace comp -} // namespace spvtools diff --git a/test/comp/CMakeLists.txt b/test/comp/CMakeLists.txt deleted file mode 100644 index c947fde0c..000000000 --- a/test/comp/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set(VAL_TEST_COMMON_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/../test_fixture.h - ${CMAKE_CURRENT_SOURCE_DIR}/../unit_spirv.h -) - -if(SPIRV_BUILD_COMPRESSION) - add_spvtools_unittest(TARGET markv_codec - SRCS - markv_codec_test.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/comp/markv_model_factory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/comp/markv_model_shader.cpp - ${VAL_TEST_COMMON_SRCS} - LIBS SPIRV-Tools-comp ${SPIRV_TOOLS} - ) -endif(SPIRV_BUILD_COMPRESSION) diff --git a/test/comp/markv_codec_test.cpp b/test/comp/markv_codec_test.cpp deleted file mode 100644 index a7af61710..000000000 --- a/test/comp/markv_codec_test.cpp +++ /dev/null @@ -1,829 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Tests for unique type declaration rules validator. - -#include -#include -#include -#include - -#include "gmock/gmock.h" -#include "source/comp/markv.h" -#include "test/test_fixture.h" -#include "test/unit_spirv.h" -#include "tools/comp/markv_model_factory.h" - -namespace spvtools { -namespace comp { -namespace { - -using spvtest::ScopedContext; -using MarkvTest = ::testing::TestWithParam; - -void DiagnosticsMessageHandler(spv_message_level_t level, const char*, - const spv_position_t& position, - const char* message) { - switch (level) { - case SPV_MSG_FATAL: - case SPV_MSG_INTERNAL_ERROR: - case SPV_MSG_ERROR: - std::cerr << "error: " << position.index << ": " << message << std::endl; - break; - case SPV_MSG_WARNING: - std::cout << "warning: " << position.index << ": " << message - << std::endl; - break; - case SPV_MSG_INFO: - std::cout << "info: " << position.index << ": " << message << std::endl; - break; - default: - break; - } -} - -// Compiles |code| to SPIR-V |words|. -void Compile(const std::string& code, std::vector* words, - uint32_t options = SPV_TEXT_TO_BINARY_OPTION_NONE, - spv_target_env env = SPV_ENV_UNIVERSAL_1_2) { - spvtools::Context ctx(env); - ctx.SetMessageConsumer(DiagnosticsMessageHandler); - - spv_binary spirv_binary; - ASSERT_EQ(SPV_SUCCESS, spvTextToBinaryWithOptions( - ctx.CContext(), code.c_str(), code.size(), options, - &spirv_binary, nullptr)); - - *words = std::vector(spirv_binary->code, - spirv_binary->code + spirv_binary->wordCount); - - spvBinaryDestroy(spirv_binary); -} - -// Disassembles SPIR-V |words| to |out_text|. -void Disassemble(const std::vector& words, std::string* out_text, - spv_target_env env = SPV_ENV_UNIVERSAL_1_2) { - spvtools::Context ctx(env); - ctx.SetMessageConsumer(DiagnosticsMessageHandler); - - spv_text text = nullptr; - ASSERT_EQ(SPV_SUCCESS, spvBinaryToText(ctx.CContext(), words.data(), - words.size(), 0, &text, nullptr)); - assert(text); - - *out_text = std::string(text->str, text->length); - spvTextDestroy(text); -} - -// Encodes/decodes |original|, assembles/dissasembles |original|, then compares -// the results of the two operations. -void TestEncodeDecode(MarkvModelType model_type, - const std::string& original_text) { - spvtools::Context ctx(SPV_ENV_UNIVERSAL_1_2); - std::unique_ptr model = CreateMarkvModel(model_type); - MarkvCodecOptions options; - - std::vector expected_binary; - Compile(original_text, &expected_binary); - ASSERT_FALSE(expected_binary.empty()); - - std::string expected_text; - Disassemble(expected_binary, &expected_text); - ASSERT_FALSE(expected_text.empty()); - - std::vector binary_to_encode; - Compile(original_text, &binary_to_encode, - SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); - ASSERT_FALSE(binary_to_encode.empty()); - - std::stringstream encoder_comments; - const auto output_to_string_stream = - [&encoder_comments](const std::string& str) { encoder_comments << str; }; - - std::vector markv; - ASSERT_EQ(SPV_SUCCESS, - SpirvToMarkv(ctx.CContext(), binary_to_encode, options, *model, - DiagnosticsMessageHandler, output_to_string_stream, - MarkvDebugConsumer(), &markv)); - ASSERT_FALSE(markv.empty()); - - std::vector decoded_binary; - ASSERT_EQ(SPV_SUCCESS, - MarkvToSpirv(ctx.CContext(), markv, options, *model, - DiagnosticsMessageHandler, MarkvLogConsumer(), - MarkvDebugConsumer(), &decoded_binary)); - ASSERT_FALSE(decoded_binary.empty()); - - EXPECT_EQ(expected_binary, decoded_binary) << encoder_comments.str(); - - std::string decoded_text; - Disassemble(decoded_binary, &decoded_text); - ASSERT_FALSE(decoded_text.empty()); - - EXPECT_EQ(expected_text, decoded_text) << encoder_comments.str(); -} - -void TestEncodeDecodeShaderMainBody(MarkvModelType model_type, - const std::string& body) { - const std::string prefix = - R"( -OpCapability Shader -OpCapability Int64 -OpCapability Float64 -%ext_inst = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" -%void = OpTypeVoid -%func = OpTypeFunction %void -%bool = OpTypeBool -%f32 = OpTypeFloat 32 -%u32 = OpTypeInt 32 0 -%s32 = OpTypeInt 32 1 -%f64 = OpTypeFloat 64 -%u64 = OpTypeInt 64 0 -%s64 = OpTypeInt 64 1 -%boolvec2 = OpTypeVector %bool 2 -%s32vec2 = OpTypeVector %s32 2 -%u32vec2 = OpTypeVector %u32 2 -%f32vec2 = OpTypeVector %f32 2 -%f64vec2 = OpTypeVector %f64 2 -%boolvec3 = OpTypeVector %bool 3 -%u32vec3 = OpTypeVector %u32 3 -%s32vec3 = OpTypeVector %s32 3 -%f32vec3 = OpTypeVector %f32 3 -%f64vec3 = OpTypeVector %f64 3 -%boolvec4 = OpTypeVector %bool 4 -%u32vec4 = OpTypeVector %u32 4 -%s32vec4 = OpTypeVector %s32 4 -%f32vec4 = OpTypeVector %f32 4 -%f64vec4 = OpTypeVector %f64 4 - -%f32_0 = OpConstant %f32 0 -%f32_1 = OpConstant %f32 1 -%f32_2 = OpConstant %f32 2 -%f32_3 = OpConstant %f32 3 -%f32_4 = OpConstant %f32 4 -%f32_pi = OpConstant %f32 3.14159 - -%s32_0 = OpConstant %s32 0 -%s32_1 = OpConstant %s32 1 -%s32_2 = OpConstant %s32 2 -%s32_3 = OpConstant %s32 3 -%s32_4 = OpConstant %s32 4 -%s32_m1 = OpConstant %s32 -1 - -%u32_0 = OpConstant %u32 0 -%u32_1 = OpConstant %u32 1 -%u32_2 = OpConstant %u32 2 -%u32_3 = OpConstant %u32 3 -%u32_4 = OpConstant %u32 4 - -%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 -%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 -%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 -%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 -%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 -%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 - -%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 -%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 -%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 -%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 -%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 -%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 - -%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 -%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 -%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 -%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 -%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 -%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 - -%main = OpFunction %void None %func -%main_entry = OpLabel)"; - - const std::string suffix = - R"( -OpReturn -OpFunctionEnd)"; - - TestEncodeDecode(model_type, prefix + body + suffix); -} - -TEST_P(MarkvTest, U32Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -%u32 = OpTypeInt 32 0 -%100 = OpConstant %u32 0 -%200 = OpConstant %u32 1 -%300 = OpConstant %u32 4294967295 -)"); -} - -TEST_P(MarkvTest, S32Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -%s32 = OpTypeInt 32 1 -%100 = OpConstant %s32 0 -%200 = OpConstant %s32 1 -%300 = OpConstant %s32 -1 -%400 = OpConstant %s32 2147483647 -%500 = OpConstant %s32 -2147483648 -)"); -} - -TEST_P(MarkvTest, U64Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpCapability Int64 -OpMemoryModel Logical GLSL450 -%u64 = OpTypeInt 64 0 -%100 = OpConstant %u64 0 -%200 = OpConstant %u64 1 -%300 = OpConstant %u64 18446744073709551615 -)"); -} - -TEST_P(MarkvTest, S64Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpCapability Int64 -OpMemoryModel Logical GLSL450 -%s64 = OpTypeInt 64 1 -%100 = OpConstant %s64 0 -%200 = OpConstant %s64 1 -%300 = OpConstant %s64 -1 -%400 = OpConstant %s64 9223372036854775807 -%500 = OpConstant %s64 -9223372036854775808 -)"); -} - -TEST_P(MarkvTest, U16Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpCapability Int16 -OpMemoryModel Logical GLSL450 -%u16 = OpTypeInt 16 0 -%100 = OpConstant %u16 0 -%200 = OpConstant %u16 1 -%300 = OpConstant %u16 65535 -)"); -} - -TEST_P(MarkvTest, S16Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpCapability Int16 -OpMemoryModel Logical GLSL450 -%s16 = OpTypeInt 16 1 -%100 = OpConstant %s16 0 -%200 = OpConstant %s16 1 -%300 = OpConstant %s16 -1 -%400 = OpConstant %s16 32767 -%500 = OpConstant %s16 -32768 -)"); -} - -TEST_P(MarkvTest, F32Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -%f32 = OpTypeFloat 32 -%100 = OpConstant %f32 0 -%200 = OpConstant %f32 1 -%300 = OpConstant %f32 0.1 -%400 = OpConstant %f32 -0.1 -)"); -} - -TEST_P(MarkvTest, F64Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpCapability Float64 -OpMemoryModel Logical GLSL450 -%f64 = OpTypeFloat 64 -%100 = OpConstant %f64 0 -%200 = OpConstant %f64 1 -%300 = OpConstant %f64 0.1 -%400 = OpConstant %f64 -0.1 -)"); -} - -TEST_P(MarkvTest, F16Literal) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpCapability Float16 -OpMemoryModel Logical GLSL450 -%f16 = OpTypeFloat 16 -%100 = OpConstant %f16 0 -%200 = OpConstant %f16 1 -%300 = OpConstant %f16 0.1 -%400 = OpConstant %f16 -0.1 -)"); -} - -TEST_P(MarkvTest, StringLiteral) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpExtension "SPV_KHR_16bit_storage" -OpExtension "xxx" -OpExtension "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" -OpExtension "" -OpMemoryModel Logical GLSL450 -)"); -} - -TEST_P(MarkvTest, WithFunction) { - TestEncodeDecode(GetParam(), R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpExtension "SPV_KHR_16bit_storage" -OpMemoryModel Physical32 OpenCL -%f32 = OpTypeFloat 32 -%u32 = OpTypeInt 32 0 -%void = OpTypeVoid -%void_func = OpTypeFunction %void -%100 = OpConstant %u32 1 -%200 = OpConstant %u32 2 -%main = OpFunction %void None %void_func -%entry_main = OpLabel -%300 = OpIAdd %u32 %100 %200 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, WithMultipleFunctions) { - TestEncodeDecode(GetParam(), R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -%f32 = OpTypeFloat 32 -%one = OpConstant %f32 1 -%void = OpTypeVoid -%void_func = OpTypeFunction %void -%f32_func = OpTypeFunction %f32 %f32 -%sqr_plus_one = OpFunction %f32 None %f32_func -%x = OpFunctionParameter %f32 -%100 = OpLabel -%x2 = OpFMul %f32 %x %x -%x2p1 = OpFunctionCall %f32 %plus_one %x2 -OpReturnValue %x2p1 -OpFunctionEnd -%plus_one = OpFunction %f32 None %f32_func -%y = OpFunctionParameter %f32 -%200 = OpLabel -%yp1 = OpFAdd %f32 %y %one -OpReturnValue %yp1 -OpFunctionEnd -%main = OpFunction %void None %void_func -%entry_main = OpLabel -%1p1 = OpFunctionCall %f32 %sqr_plus_one %one -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, ForwardDeclaredId) { - TestEncodeDecode(GetParam(), R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -OpEntryPoint Kernel %1 "simple_kernel" -%2 = OpTypeInt 32 0 -%3 = OpTypeVector %2 2 -%4 = OpConstant %2 2 -%5 = OpTypeArray %2 %4 -%6 = OpTypeVoid -%7 = OpTypeFunction %6 -%1 = OpFunction %6 None %7 -%8 = OpLabel -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, WithSwitch) { - TestEncodeDecode(GetParam(), R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpCapability Int64 -OpMemoryModel Physical32 OpenCL -%u64 = OpTypeInt 64 0 -%void = OpTypeVoid -%void_func = OpTypeFunction %void -%val = OpConstant %u64 1 -%main = OpFunction %void None %void_func -%entry_main = OpLabel -OpSwitch %val %default 1 %case1 1000000000000 %case2 -%case1 = OpLabel -OpNop -OpBranch %after_switch -%case2 = OpLabel -OpNop -OpBranch %after_switch -%default = OpLabel -OpNop -OpBranch %after_switch -%after_switch = OpLabel -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, WithLoop) { - TestEncodeDecode(GetParam(), R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -%void = OpTypeVoid -%void_func = OpTypeFunction %void -%main = OpFunction %void None %void_func -%entry_main = OpLabel -OpLoopMerge %merge %continue DontUnroll|DependencyLength 10 -OpBranch %begin_loop -%begin_loop = OpLabel -OpNop -OpBranch %continue -%continue = OpLabel -OpNop -OpBranch %begin_loop -%merge = OpLabel -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, WithDecorate) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -OpDecorate %1 ArrayStride 4 -OpDecorate %1 Uniform -%2 = OpTypeFloat 32 -%1 = OpTypeRuntimeArray %2 -)"); -} - -TEST_P(MarkvTest, WithExtInst) { - TestEncodeDecode(GetParam(), R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -%opencl = OpExtInstImport "OpenCL.std" -OpMemoryModel Physical32 OpenCL -%f32 = OpTypeFloat 32 -%void = OpTypeVoid -%void_func = OpTypeFunction %void -%100 = OpConstant %f32 1.1 -%main = OpFunction %void None %void_func -%entry_main = OpLabel -%200 = OpExtInst %f32 %opencl cos %100 -OpReturn -OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, F32Mul) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%val1 = OpFMul %f32 %f32_0 %f32_1 -%val2 = OpFMul %f32 %f32_2 %f32_0 -%val3 = OpFMul %f32 %f32_pi %f32_2 -%val4 = OpFMul %f32 %f32_1 %f32_1 -)"); -} - -TEST_P(MarkvTest, U32Mul) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%val1 = OpIMul %u32 %u32_0 %u32_1 -%val2 = OpIMul %u32 %u32_2 %u32_0 -%val3 = OpIMul %u32 %u32_3 %u32_2 -%val4 = OpIMul %u32 %u32_1 %u32_1 -)"); -} - -TEST_P(MarkvTest, S32Mul) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%val1 = OpIMul %s32 %s32_0 %s32_1 -%val2 = OpIMul %s32 %s32_2 %s32_0 -%val3 = OpIMul %s32 %s32_m1 %s32_2 -%val4 = OpIMul %s32 %s32_1 %s32_1 -)"); -} - -TEST_P(MarkvTest, F32Add) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%val1 = OpFAdd %f32 %f32_0 %f32_1 -%val2 = OpFAdd %f32 %f32_2 %f32_0 -%val3 = OpFAdd %f32 %f32_pi %f32_2 -%val4 = OpFAdd %f32 %f32_1 %f32_1 -)"); -} - -TEST_P(MarkvTest, U32Add) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%val1 = OpIAdd %u32 %u32_0 %u32_1 -%val2 = OpIAdd %u32 %u32_2 %u32_0 -%val3 = OpIAdd %u32 %u32_3 %u32_2 -%val4 = OpIAdd %u32 %u32_1 %u32_1 -)"); -} - -TEST_P(MarkvTest, S32Add) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%val1 = OpIAdd %s32 %s32_0 %s32_1 -%val2 = OpIAdd %s32 %s32_2 %s32_0 -%val3 = OpIAdd %s32 %s32_m1 %s32_2 -%val4 = OpIAdd %s32 %s32_1 %s32_1 -)"); -} - -TEST_P(MarkvTest, F32Dot) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%dot2_1 = OpDot %f32 %f32vec2_01 %f32vec2_12 -%dot2_2 = OpDot %f32 %f32vec2_01 %f32vec2_01 -%dot2_3 = OpDot %f32 %f32vec2_12 %f32vec2_12 -%dot3_1 = OpDot %f32 %f32vec3_012 %f32vec3_123 -%dot3_2 = OpDot %f32 %f32vec3_012 %f32vec3_012 -%dot3_3 = OpDot %f32 %f32vec3_123 %f32vec3_123 -%dot4_1 = OpDot %f32 %f32vec4_0123 %f32vec4_1234 -%dot4_2 = OpDot %f32 %f32vec4_0123 %f32vec4_0123 -%dot4_3 = OpDot %f32 %f32vec4_1234 %f32vec4_1234 -)"); -} - -TEST_P(MarkvTest, F32VectorCompositeConstruct) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%cc1 = OpCompositeConstruct %f32vec4 %f32vec2_01 %f32vec2_12 -%cc2 = OpCompositeConstruct %f32vec3 %f32vec2_01 %f32_2 -%cc3 = OpCompositeConstruct %f32vec2 %f32_1 %f32_2 -%cc4 = OpCompositeConstruct %f32vec4 %f32_1 %f32_2 %cc3 -)"); -} - -TEST_P(MarkvTest, U32VectorCompositeConstruct) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%cc1 = OpCompositeConstruct %u32vec4 %u32vec2_01 %u32vec2_12 -%cc2 = OpCompositeConstruct %u32vec3 %u32vec2_01 %u32_2 -%cc3 = OpCompositeConstruct %u32vec2 %u32_1 %u32_2 -%cc4 = OpCompositeConstruct %u32vec4 %u32_1 %u32_2 %cc3 -)"); -} - -TEST_P(MarkvTest, S32VectorCompositeConstruct) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%cc1 = OpCompositeConstruct %u32vec4 %u32vec2_01 %u32vec2_12 -%cc2 = OpCompositeConstruct %u32vec3 %u32vec2_01 %u32_2 -%cc3 = OpCompositeConstruct %u32vec2 %u32_1 %u32_2 -%cc4 = OpCompositeConstruct %u32vec4 %u32_1 %u32_2 %cc3 -)"); -} - -TEST_P(MarkvTest, F32VectorCompositeExtract) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 -%f32vec3_013 = OpCompositeExtract %f32vec3 %f32vec4_0123 0 1 3 -)"); -} - -TEST_P(MarkvTest, F32VectorComparison) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 -%c1 = OpFOrdEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c2 = OpFUnordEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c3 = OpFOrdNotEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c4 = OpFUnordNotEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c5 = OpFOrdLessThan %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c6 = OpFUnordLessThan %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c7 = OpFOrdGreaterThan %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c8 = OpFUnordGreaterThan %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c9 = OpFOrdLessThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c10 = OpFUnordLessThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c11 = OpFOrdGreaterThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -%c12 = OpFUnordGreaterThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 -)"); -} - -TEST_P(MarkvTest, VectorShuffle) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 -%sh1 = OpVectorShuffle %f32vec2 %f32vec4_0123 %f32vec4_3210 3 6 -%sh2 = OpVectorShuffle %f32vec3 %f32vec2_01 %f32vec4_3210 0 3 4 -)"); -} - -TEST_P(MarkvTest, VectorTimesScalar) { - TestEncodeDecodeShaderMainBody(GetParam(), R"( -%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 -%res1 = OpVectorTimesScalar %f32vec4 %f32vec4_0123 %f32_2 -%res2 = OpVectorTimesScalar %f32vec4 %f32vec4_3210 %f32_2 -)"); -} - -TEST_P(MarkvTest, SpirvSpecSample) { - TestEncodeDecode(GetParam(), R"( - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Fragment %4 "main" %31 %33 %42 %57 - OpExecutionMode %4 OriginLowerLeft - -; Debug information - OpSource GLSL 450 - OpName %4 "main" - OpName %9 "scale" - OpName %17 "S" - OpMemberName %17 0 "b" - OpMemberName %17 1 "v" - OpMemberName %17 2 "i" - OpName %18 "blockName" - OpMemberName %18 0 "s" - OpMemberName %18 1 "cond" - OpName %20 "" - OpName %31 "color" - OpName %33 "color1" - OpName %42 "color2" - OpName %48 "i" - OpName %57 "multiplier" - -; Annotations (non-debug) - OpDecorate %15 ArrayStride 16 - OpMemberDecorate %17 0 Offset 0 - OpMemberDecorate %17 1 Offset 16 - OpMemberDecorate %17 2 Offset 96 - OpMemberDecorate %18 0 Offset 0 - OpMemberDecorate %18 1 Offset 112 - OpDecorate %18 Block - OpDecorate %20 DescriptorSet 0 - OpDecorate %42 NoPerspective - -; All types, variables, and constants - %2 = OpTypeVoid - %3 = OpTypeFunction %2 ; void () - %6 = OpTypeFloat 32 ; 32-bit float - %7 = OpTypeVector %6 4 ; vec4 - %8 = OpTypePointer Function %7 ; function-local vec4* - %10 = OpConstant %6 1 - %11 = OpConstant %6 2 - %12 = OpConstantComposite %7 %10 %10 %11 %10 ; vec4(1.0, 1.0, 2.0, 1.0) - %13 = OpTypeInt 32 0 ; 32-bit int, sign-less - %14 = OpConstant %13 5 - %15 = OpTypeArray %7 %14 - %16 = OpTypeInt 32 1 - %17 = OpTypeStruct %13 %15 %16 - %18 = OpTypeStruct %17 %13 - %19 = OpTypePointer Uniform %18 - %20 = OpVariable %19 Uniform - %21 = OpConstant %16 1 - %22 = OpTypePointer Uniform %13 - %25 = OpTypeBool - %26 = OpConstant %13 0 - %30 = OpTypePointer Output %7 - %31 = OpVariable %30 Output - %32 = OpTypePointer Input %7 - %33 = OpVariable %32 Input - %35 = OpConstant %16 0 - %36 = OpConstant %16 2 - %37 = OpTypePointer Uniform %7 - %42 = OpVariable %32 Input - %47 = OpTypePointer Function %16 - %55 = OpConstant %16 4 - %57 = OpVariable %32 Input - -; All functions - %4 = OpFunction %2 None %3 ; main() - %5 = OpLabel - %9 = OpVariable %8 Function - %48 = OpVariable %47 Function - OpStore %9 %12 - %23 = OpAccessChain %22 %20 %21 ; location of cond - %24 = OpLoad %13 %23 ; load 32-bit int from cond - %27 = OpINotEqual %25 %24 %26 ; convert to bool - OpSelectionMerge %29 None ; structured if - OpBranchConditional %27 %28 %41 ; if cond - %28 = OpLabel ; then - %34 = OpLoad %7 %33 - %38 = OpAccessChain %37 %20 %35 %21 %36 ; s.v[2] - %39 = OpLoad %7 %38 - %40 = OpFAdd %7 %34 %39 - OpStore %31 %40 - OpBranch %29 - %41 = OpLabel ; else - %43 = OpLoad %7 %42 - %44 = OpExtInst %7 %1 Sqrt %43 ; extended instruction sqrt - %45 = OpLoad %7 %9 - %46 = OpFMul %7 %44 %45 - OpStore %31 %46 - OpBranch %29 - %29 = OpLabel ; endif - OpStore %48 %35 - OpBranch %49 - %49 = OpLabel - OpLoopMerge %51 %52 None ; structured loop - OpBranch %53 - %53 = OpLabel - %54 = OpLoad %16 %48 - %56 = OpSLessThan %25 %54 %55 ; i < 4 ? - OpBranchConditional %56 %50 %51 ; body or break - %50 = OpLabel ; body - %58 = OpLoad %7 %57 - %59 = OpLoad %7 %31 - %60 = OpFMul %7 %59 %58 - OpStore %31 %60 - OpBranch %52 - %52 = OpLabel ; continue target - %61 = OpLoad %16 %48 - %62 = OpIAdd %16 %61 %21 ; ++i - OpStore %48 %62 - OpBranch %49 ; loop back - %51 = OpLabel ; loop merge point - OpReturn - OpFunctionEnd -)"); -} - -TEST_P(MarkvTest, SampleFromDeadBranchEliminationTest) { - TestEncodeDecode(GetParam(), R"( -OpCapability Shader -%1 = OpExtInstImport "GLSL.std.450" -OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %main "main" %gl_FragColor -OpExecutionMode %main OriginUpperLeft -OpSource GLSL 140 -OpName %main "main" -OpName %gl_FragColor "gl_FragColor" -%void = OpTypeVoid -%5 = OpTypeFunction %void -%bool = OpTypeBool -%true = OpConstantTrue %bool -%float = OpTypeFloat 32 -%v4float = OpTypeVector %float 4 -%_ptr_Function_v4float = OpTypePointer Function %v4float -%float_0 = OpConstant %float 0 -%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 -%float_1 = OpConstant %float 1 -%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 -%_ptr_Output_v4float = OpTypePointer Output %v4float -%gl_FragColor = OpVariable %_ptr_Output_v4float Output -%_ptr_Input_v4float = OpTypePointer Input %v4float -%main = OpFunction %void None %5 -%17 = OpLabel -OpSelectionMerge %18 None -OpBranchConditional %true %19 %20 -%19 = OpLabel -OpBranch %18 -%20 = OpLabel -OpBranch %18 -%18 = OpLabel -%21 = OpPhi %v4float %12 %19 %14 %20 -OpStore %gl_FragColor %21 -OpReturn -OpFunctionEnd -)"); -} - -INSTANTIATE_TEST_SUITE_P(AllMarkvModels, MarkvTest, - ::testing::ValuesIn(std::vector{ - kMarkvModelShaderLite, - kMarkvModelShaderMid, - kMarkvModelShaderMax, - })); - -} // namespace -} // namespace comp -} // namespace spvtools diff --git a/test/huffman_codec.cpp b/test/huffman_codec.cpp deleted file mode 100644 index 58a781061..000000000 --- a/test/huffman_codec.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include -#include - -#include "gmock/gmock.h" -#include "source/comp/bit_stream.h" -#include "source/comp/huffman_codec.h" - -namespace spvtools { -namespace comp { -namespace { - -const std::map& GetTestSet() { - static const std::map hist = { - {"a", 4}, {"e", 7}, {"f", 3}, {"h", 2}, {"i", 3}, - {"m", 2}, {"n", 2}, {"s", 2}, {"t", 2}, {"l", 1}, - {"o", 2}, {"p", 1}, {"r", 1}, {"u", 1}, {"x", 1}, - }; - - return hist; -} - -class TestBitReader { - public: - TestBitReader(const std::string& bits) : bits_(bits) {} - - bool ReadBit(bool* bit) { - if (pos_ < bits_.length()) { - *bit = bits_[pos_++] == '0' ? false : true; - return true; - } - return false; - } - - private: - std::string bits_; - size_t pos_ = 0; -}; - -TEST(Huffman, PrintTree) { - HuffmanCodec huffman(GetTestSet()); - std::stringstream ss; - huffman.PrintTree(ss); - - // clang-format off - const std::string expected = std::string(R"( -15-----7------e - 8------4------a - 4------2------m - 2------n -19-----8------4------2------o - 2------s - 4------2------t - 2------1------l - 1------p - 11-----5------2------1------r - 1------u - 3------f - 6------3------i - 3------1------x - 2------h -)").substr(1); - // clang-format on - - EXPECT_EQ(expected, ss.str()); -} - -TEST(Huffman, PrintTable) { - HuffmanCodec huffman(GetTestSet()); - std::stringstream ss; - huffman.PrintTable(ss); - - const std::string expected = std::string(R"( -e 7 11 -a 4 101 -i 3 0001 -f 3 0010 -t 2 0101 -s 2 0110 -o 2 0111 -n 2 1000 -m 2 1001 -h 2 00000 -x 1 00001 -u 1 00110 -r 1 00111 -p 1 01000 -l 1 01001 -)") - .substr(1); - - EXPECT_EQ(expected, ss.str()); -} - -TEST(Huffman, TestValidity) { - HuffmanCodec huffman(GetTestSet()); - const auto& encoding_table = huffman.GetEncodingTable(); - std::vector codes; - for (const auto& entry : encoding_table) { - codes.push_back(BitsToStream(entry.second.first, entry.second.second)); - } - - std::sort(codes.begin(), codes.end()); - - ASSERT_LT(codes.size(), 20u) << "Inefficient test ahead"; - - for (size_t i = 0; i < codes.size(); ++i) { - for (size_t j = i + 1; j < codes.size(); ++j) { - ASSERT_FALSE(codes[i] == codes[j].substr(0, codes[i].length())) - << codes[i] << " is prefix of " << codes[j]; - } - } -} - -TEST(Huffman, TestEncode) { - HuffmanCodec huffman(GetTestSet()); - - uint64_t bits = 0; - size_t num_bits = 0; - - EXPECT_TRUE(huffman.Encode("e", &bits, &num_bits)); - EXPECT_EQ(2u, num_bits); - EXPECT_EQ("11", BitsToStream(bits, num_bits)); - - EXPECT_TRUE(huffman.Encode("a", &bits, &num_bits)); - EXPECT_EQ(3u, num_bits); - EXPECT_EQ("101", BitsToStream(bits, num_bits)); - - EXPECT_TRUE(huffman.Encode("x", &bits, &num_bits)); - EXPECT_EQ(5u, num_bits); - EXPECT_EQ("00001", BitsToStream(bits, num_bits)); - - EXPECT_FALSE(huffman.Encode("y", &bits, &num_bits)); -} - -TEST(Huffman, TestDecode) { - HuffmanCodec huffman(GetTestSet()); - TestBitReader bit_reader( - "01001" - "0001" - "1000" - "00110" - "00001" - "00"); - auto read_bit = [&bit_reader](bool* bit) { return bit_reader.ReadBit(bit); }; - - std::string decoded; - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ("l", decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ("i", decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ("n", decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ("u", decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ("x", decoded); - - ASSERT_FALSE(huffman.DecodeFromStream(read_bit, &decoded)); -} - -TEST(Huffman, TestDecodeNumbers) { - const std::map hist = {{1, 10}, {2, 5}, {3, 15}}; - HuffmanCodec huffman(hist); - - TestBitReader bit_reader( - "1" - "1" - "01" - "00" - "01" - "1"); - auto read_bit = [&bit_reader](bool* bit) { return bit_reader.ReadBit(bit); }; - - uint32_t decoded; - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(3u, decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(3u, decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(2u, decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(1u, decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(2u, decoded); - - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(3u, decoded); -} - -TEST(Huffman, SerializeToTextU64) { - const std::map hist = {{1001, 10}, {1002, 5}, {1003, 15}}; - HuffmanCodec huffman(hist); - - const std::string code = huffman.SerializeToText(2); - - const std::string expected = R"((5, { - {0, 0, 0}, - {1001, 0, 0}, - {1002, 0, 0}, - {1003, 0, 0}, - {0, 1, 2}, - {0, 4, 3}, - }))"; - - ASSERT_EQ(expected, code); -} - -TEST(Huffman, SerializeToTextString) { - const std::map hist = { - {"aaa", 10}, {"bbb", 20}, {"ccc", 15}}; - HuffmanCodec huffman(hist); - - const std::string code = huffman.SerializeToText(4); - - const std::string expected = R"((5, { - {"", 0, 0}, - {"aaa", 0, 0}, - {"bbb", 0, 0}, - {"ccc", 0, 0}, - {"", 3, 1}, - {"", 4, 2}, - }))"; - - ASSERT_EQ(expected, code); -} - -TEST(Huffman, CreateFromTextString) { - std::vector::Node> nodes = { - {}, - {"root", 2, 3}, - {"left", 0, 0}, - {"right", 0, 0}, - }; - - HuffmanCodec huffman(1, std::move(nodes)); - - std::stringstream ss; - huffman.PrintTree(ss); - - const std::string expected = std::string(R"( -0------right -0------left -)") - .substr(1); - - EXPECT_EQ(expected, ss.str()); -} - -TEST(Huffman, CreateFromTextU64) { - HuffmanCodec huffman(5, { - {0, 0, 0}, - {1001, 0, 0}, - {1002, 0, 0}, - {1003, 0, 0}, - {0, 1, 2}, - {0, 4, 3}, - }); - - std::stringstream ss; - huffman.PrintTree(ss); - - const std::string expected = std::string(R"( -0------1003 -0------0------1002 - 0------1001 -)") - .substr(1); - - EXPECT_EQ(expected, ss.str()); - - TestBitReader bit_reader("01"); - auto read_bit = [&bit_reader](bool* bit) { return bit_reader.ReadBit(bit); }; - - uint64_t decoded = 0; - ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); - EXPECT_EQ(1002u, decoded); - - uint64_t bits = 0; - size_t num_bits = 0; - - EXPECT_TRUE(huffman.Encode(1001, &bits, &num_bits)); - EXPECT_EQ(2u, num_bits); - EXPECT_EQ("00", BitsToStream(bits, num_bits)); -} - -} // namespace -} // namespace comp -} // namespace spvtools diff --git a/test/move_to_front_test.cpp b/test/move_to_front_test.cpp deleted file mode 100644 index c95d38656..000000000 --- a/test/move_to_front_test.cpp +++ /dev/null @@ -1,828 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include - -#include "gmock/gmock.h" -#include "source/comp/move_to_front.h" - -namespace spvtools { -namespace comp { -namespace { - -// Class used to test the inner workings of MoveToFront. -class MoveToFrontTester : public MoveToFront { - public: - // Inserts the value in the internal tree data structure. For testing only. - void TestInsert(uint32_t val) { InsertNode(CreateNode(val, val)); } - - // Removes the value from the internal tree data structure. For testing only. - void TestRemove(uint32_t val) { - const auto it = value_to_node_.find(val); - assert(it != value_to_node_.end()); - RemoveNode(it->second); - } - - // Prints the internal tree data structure to |out|. For testing only. - void PrintTree(std::ostream& out, bool print_timestamp = false) const { - if (root_) PrintTreeInternal(out, root_, 1, print_timestamp); - } - - // Returns node handle corresponding to the value. The value may not be in the - // tree. - uint32_t GetNodeHandle(uint32_t value) const { - const auto it = value_to_node_.find(value); - if (it == value_to_node_.end()) return 0; - - return it->second; - } - - // Returns total node count (both those in the tree and removed, - // but not the NIL singleton). - size_t GetTotalNodeCount() const { - assert(nodes_.size()); - return nodes_.size() - 1; - } - - uint32_t GetLastAccessedValue() const { return last_accessed_value_; } - - private: - // Prints the internal tree data structure for debug purposes in the following - // format: - // 10H3S4----5H1S1-----D2 - // 15H2S2----12H1S1----D3 - // Right links are horizontal, left links step down one line. - // 5H1S1 is read as value 5, height 1, size 1. Optionally node label can also - // contain timestamp (5H1S1T15). D3 stands for depth 3. - void PrintTreeInternal(std::ostream& out, uint32_t node, size_t depth, - bool print_timestamp) const; -}; - -void MoveToFrontTester::PrintTreeInternal(std::ostream& out, uint32_t node, - size_t depth, - bool print_timestamp) const { - if (!node) { - out << "D" << depth - 1 << std::endl; - return; - } - - const size_t kTextFieldWvaluethWithoutTimestamp = 10; - const size_t kTextFieldWvaluethWithTimestamp = 14; - const size_t text_field_wvalueth = print_timestamp - ? kTextFieldWvaluethWithTimestamp - : kTextFieldWvaluethWithoutTimestamp; - - std::stringstream label; - label << ValueOf(node) << "H" << HeightOf(node) << "S" << SizeOf(node); - if (print_timestamp) label << "T" << TimestampOf(node); - const size_t label_length = label.str().length(); - if (label_length < text_field_wvalueth) - label << std::string(text_field_wvalueth - label_length, '-'); - - out << label.str(); - - PrintTreeInternal(out, RightOf(node), depth + 1, print_timestamp); - - if (LeftOf(node)) { - out << std::string(depth * text_field_wvalueth, ' '); - PrintTreeInternal(out, LeftOf(node), depth + 1, print_timestamp); - } -} - -void CheckTree(const MoveToFrontTester& mtf, const std::string& expected, - bool print_timestamp = false) { - std::stringstream ss; - mtf.PrintTree(ss, print_timestamp); - EXPECT_EQ(expected, ss.str()); -} - -TEST(MoveToFront, EmptyTree) { - MoveToFrontTester mtf; - CheckTree(mtf, std::string()); -} - -TEST(MoveToFront, InsertLeftRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(30); - mtf.TestInsert(20); - - CheckTree(mtf, std::string(R"( -30H2S2----20H1S1----D2 -)") - .substr(1)); - - mtf.TestInsert(10); - CheckTree(mtf, std::string(R"( -20H2S3----10H1S1----D2 - 30H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, InsertRightRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(20); - - CheckTree(mtf, std::string(R"( -10H2S2----D1 - 20H1S1----D2 -)") - .substr(1)); - - mtf.TestInsert(30); - CheckTree(mtf, std::string(R"( -20H2S3----10H1S1----D2 - 30H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, InsertRightLeftRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(30); - mtf.TestInsert(20); - - CheckTree(mtf, std::string(R"( -30H2S2----20H1S1----D2 -)") - .substr(1)); - - mtf.TestInsert(25); - CheckTree(mtf, std::string(R"( -25H2S3----20H1S1----D2 - 30H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, InsertLeftRightRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(20); - - CheckTree(mtf, std::string(R"( -10H2S2----D1 - 20H1S1----D2 -)") - .substr(1)); - - mtf.TestInsert(15); - CheckTree(mtf, std::string(R"( -15H2S3----10H1S1----D2 - 20H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, RemoveSingleton) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - CheckTree(mtf, std::string(R"( -10H1S1----D1 -)") - .substr(1)); - - mtf.TestRemove(10); - CheckTree(mtf, ""); -} - -TEST(MoveToFront, RemoveRootWithScapegoat) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(5); - mtf.TestInsert(15); - CheckTree(mtf, std::string(R"( -10H2S3----5H1S1-----D2 - 15H1S1----D2 -)") - .substr(1)); - - mtf.TestRemove(10); - CheckTree(mtf, std::string(R"( -15H2S2----5H1S1-----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, RemoveRightRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(5); - mtf.TestInsert(15); - mtf.TestInsert(20); - CheckTree(mtf, std::string(R"( -10H3S4----5H1S1-----D2 - 15H2S2----D2 - 20H1S1----D3 -)") - .substr(1)); - - mtf.TestRemove(5); - - CheckTree(mtf, std::string(R"( -15H2S3----10H1S1----D2 - 20H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, RemoveLeftRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(15); - mtf.TestInsert(5); - mtf.TestInsert(1); - CheckTree(mtf, std::string(R"( -10H3S4----5H2S2-----1H1S1-----D3 - 15H1S1----D2 -)") - .substr(1)); - - mtf.TestRemove(15); - - CheckTree(mtf, std::string(R"( -5H2S3-----1H1S1-----D2 - 10H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, RemoveLeftRightRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(15); - mtf.TestInsert(5); - mtf.TestInsert(12); - CheckTree(mtf, std::string(R"( -10H3S4----5H1S1-----D2 - 15H2S2----12H1S1----D3 -)") - .substr(1)); - - mtf.TestRemove(5); - - CheckTree(mtf, std::string(R"( -12H2S3----10H1S1----D2 - 15H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, RemoveRightLeftRotation) { - MoveToFrontTester mtf; - - mtf.TestInsert(10); - mtf.TestInsert(15); - mtf.TestInsert(5); - mtf.TestInsert(8); - CheckTree(mtf, std::string(R"( -10H3S4----5H2S2-----D2 - 8H1S1-----D3 - 15H1S1----D2 -)") - .substr(1)); - - mtf.TestRemove(15); - - CheckTree(mtf, std::string(R"( -8H2S3-----5H1S1-----D2 - 10H1S1----D2 -)") - .substr(1)); -} - -TEST(MoveToFront, MultipleOperations) { - MoveToFrontTester mtf; - std::vector vals = {5, 11, 12, 16, 15, 6, 14, 2, - 7, 10, 4, 8, 9, 3, 1, 13}; - - for (uint32_t i : vals) { - mtf.TestInsert(i); - } - - CheckTree(mtf, std::string(R"( -11H5S16---5H4S10----3H3S4-----2H2S2-----1H1S1-----D5 - 4H1S1-----D4 - 7H3S5-----6H1S1-----D4 - 9H2S3-----8H1S1-----D5 - 10H1S1----D5 - 15H3S5----13H2S3----12H1S1----D4 - 14H1S1----D4 - 16H1S1----D3 -)") - .substr(1)); - - mtf.TestRemove(11); - - CheckTree(mtf, std::string(R"( -10H5S15---5H4S9-----3H3S4-----2H2S2-----1H1S1-----D5 - 4H1S1-----D4 - 7H3S4-----6H1S1-----D4 - 9H2S2-----8H1S1-----D5 - 15H3S5----13H2S3----12H1S1----D4 - 14H1S1----D4 - 16H1S1----D3 -)") - .substr(1)); - - mtf.TestInsert(11); - - CheckTree(mtf, std::string(R"( -10H5S16---5H4S9-----3H3S4-----2H2S2-----1H1S1-----D5 - 4H1S1-----D4 - 7H3S4-----6H1S1-----D4 - 9H2S2-----8H1S1-----D5 - 13H3S6----12H2S2----11H1S1----D4 - 15H2S3----14H1S1----D4 - 16H1S1----D4 -)") - .substr(1)); - - mtf.TestRemove(5); - - CheckTree(mtf, std::string(R"( -10H5S15---6H4S8-----3H3S4-----2H2S2-----1H1S1-----D5 - 4H1S1-----D4 - 8H2S3-----7H1S1-----D4 - 9H1S1-----D4 - 13H3S6----12H2S2----11H1S1----D4 - 15H2S3----14H1S1----D4 - 16H1S1----D4 -)") - .substr(1)); - - mtf.TestInsert(5); - - CheckTree(mtf, std::string(R"( -10H5S16---6H4S9-----3H3S5-----2H2S2-----1H1S1-----D5 - 4H2S2-----D4 - 5H1S1-----D5 - 8H2S3-----7H1S1-----D4 - 9H1S1-----D4 - 13H3S6----12H2S2----11H1S1----D4 - 15H2S3----14H1S1----D4 - 16H1S1----D4 -)") - .substr(1)); - - mtf.TestRemove(2); - mtf.TestRemove(1); - mtf.TestRemove(4); - mtf.TestRemove(3); - mtf.TestRemove(6); - mtf.TestRemove(5); - mtf.TestRemove(7); - mtf.TestRemove(9); - - CheckTree(mtf, std::string(R"( -13H4S8----10H3S4----8H1S1-----D3 - 12H2S2----11H1S1----D4 - 15H2S3----14H1S1----D3 - 16H1S1----D3 -)") - .substr(1)); -} - -TEST(MoveToFront, BiggerScaleTreeTest) { - MoveToFrontTester mtf; - std::set all_vals; - - const uint32_t kMagic1 = 2654435761; - const uint32_t kMagic2 = 10000; - - for (uint32_t i = 1; i < 1000; ++i) { - const uint32_t val = (i * kMagic1) % kMagic2; - if (!all_vals.count(val)) { - mtf.TestInsert(val); - all_vals.insert(val); - } - } - - for (uint32_t i = 1; i < 1000; ++i) { - const uint32_t val = (i * kMagic1) % kMagic2; - if (val % 2 == 0) { - mtf.TestRemove(val); - all_vals.erase(val); - } - } - - for (uint32_t i = 1000; i < 2000; ++i) { - const uint32_t val = (i * kMagic1) % kMagic2; - if (!all_vals.count(val)) { - mtf.TestInsert(val); - all_vals.insert(val); - } - } - - for (uint32_t i = 1; i < 2000; ++i) { - const uint32_t val = (i * kMagic1) % kMagic2; - if (val > 50) { - mtf.TestRemove(val); - all_vals.erase(val); - } - } - - EXPECT_EQ(all_vals, std::set({2, 4, 11, 13, 24, 33, 35, 37, 46})); - - CheckTree(mtf, std::string(R"( -33H4S9----11H3S5----2H2S2-----D3 - 4H1S1-----D4 - 13H2S2----D3 - 24H1S1----D4 - 37H2S3----35H1S1----D3 - 46H1S1----D3 -)") - .substr(1)); -} - -TEST(MoveToFront, RankFromValue) { - MoveToFrontTester mtf; - - uint32_t rank = 0; - EXPECT_FALSE(mtf.RankFromValue(1, &rank)); - - EXPECT_TRUE(mtf.Insert(1)); - EXPECT_TRUE(mtf.Insert(2)); - EXPECT_TRUE(mtf.Insert(3)); - EXPECT_FALSE(mtf.Insert(2)); - CheckTree(mtf, - std::string(R"( -2H2S3T2-------1H1S1T1-------D2 - 3H1S1T3-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_FALSE(mtf.RankFromValue(4, &rank)); - - EXPECT_TRUE(mtf.RankFromValue(1, &rank)); - EXPECT_EQ(3u, rank); - - CheckTree(mtf, - std::string(R"( -3H2S3T3-------2H1S1T2-------D2 - 1H1S1T4-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.RankFromValue(1, &rank)); - EXPECT_EQ(1u, rank); - - EXPECT_TRUE(mtf.RankFromValue(3, &rank)); - EXPECT_EQ(2u, rank); - - EXPECT_TRUE(mtf.RankFromValue(2, &rank)); - EXPECT_EQ(3u, rank); - - EXPECT_TRUE(mtf.Insert(40)); - - EXPECT_TRUE(mtf.RankFromValue(1, &rank)); - EXPECT_EQ(4u, rank); - - EXPECT_TRUE(mtf.Insert(50)); - - EXPECT_TRUE(mtf.RankFromValue(1, &rank)); - EXPECT_EQ(2u, rank); - - CheckTree(mtf, - std::string(R"( -2H3S5T6-------3H1S1T5-------D2 - 50H2S3T9------40H1S1T7------D3 - 1H1S1T10------D3 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.RankFromValue(50, &rank)); - EXPECT_EQ(2u, rank); - - EXPECT_EQ(5u, mtf.GetSize()); - CheckTree(mtf, - std::string(R"( -2H3S5T6-------3H1S1T5-------D2 - 1H2S3T10------40H1S1T7------D3 - 50H1S1T11-----D3 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_FALSE(mtf.RankFromValue(0, &rank)); - EXPECT_FALSE(mtf.RankFromValue(20, &rank)); -} - -TEST(MoveToFront, ValueFromRank) { - MoveToFrontTester mtf; - - uint32_t value = 0; - EXPECT_FALSE(mtf.ValueFromRank(0, &value)); - EXPECT_FALSE(mtf.ValueFromRank(1, &value)); - - EXPECT_TRUE(mtf.Insert(1)); - EXPECT_EQ(1u, mtf.GetLastAccessedValue()); - EXPECT_TRUE(mtf.Insert(2)); - EXPECT_EQ(2u, mtf.GetLastAccessedValue()); - EXPECT_TRUE(mtf.Insert(3)); - EXPECT_EQ(3u, mtf.GetLastAccessedValue()); - - EXPECT_TRUE(mtf.ValueFromRank(3, &value)); - EXPECT_EQ(1u, value); - EXPECT_EQ(1u, mtf.GetLastAccessedValue()); - - EXPECT_TRUE(mtf.ValueFromRank(1, &value)); - EXPECT_EQ(1u, value); - EXPECT_EQ(1u, mtf.GetLastAccessedValue()); - - CheckTree(mtf, - std::string(R"( -3H2S3T3-------2H1S1T2-------D2 - 1H1S1T4-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.ValueFromRank(2, &value)); - EXPECT_EQ(3u, value); - - EXPECT_EQ(3u, mtf.GetSize()); - - CheckTree(mtf, - std::string(R"( -1H2S3T4-------2H1S1T2-------D2 - 3H1S1T5-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.ValueFromRank(3, &value)); - EXPECT_EQ(2u, value); - - CheckTree(mtf, - std::string(R"( -3H2S3T5-------1H1S1T4-------D2 - 2H1S1T6-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.Insert(10)); - CheckTree(mtf, - std::string(R"( -3H3S4T5-------1H1S1T4-------D2 - 2H2S2T6-------D2 - 10H1S1T7------D3 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.ValueFromRank(1, &value)); - EXPECT_EQ(10u, value); -} - -TEST(MoveToFront, Remove) { - MoveToFrontTester mtf; - - EXPECT_FALSE(mtf.Remove(1)); - EXPECT_EQ(0u, mtf.GetTotalNodeCount()); - - EXPECT_TRUE(mtf.Insert(1)); - EXPECT_TRUE(mtf.Insert(2)); - EXPECT_TRUE(mtf.Insert(3)); - - CheckTree(mtf, - std::string(R"( -2H2S3T2-------1H1S1T1-------D2 - 3H1S1T3-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_EQ(1u, mtf.GetNodeHandle(1)); - EXPECT_EQ(3u, mtf.GetTotalNodeCount()); - EXPECT_TRUE(mtf.Remove(1)); - EXPECT_EQ(3u, mtf.GetTotalNodeCount()); - - CheckTree(mtf, - std::string(R"( -2H2S2T2-------D1 - 3H1S1T3-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - uint32_t value = 0; - EXPECT_TRUE(mtf.ValueFromRank(2, &value)); - EXPECT_EQ(2u, value); - - CheckTree(mtf, - std::string(R"( -3H2S2T3-------D1 - 2H1S1T4-------D2 -)") - .substr(1), - /* print_timestamp = */ true); - - EXPECT_TRUE(mtf.Insert(1)); - EXPECT_EQ(1u, mtf.GetNodeHandle(1)); - EXPECT_EQ(3u, mtf.GetTotalNodeCount()); -} - -TEST(MoveToFront, LargerScale) { - MoveToFrontTester mtf; - uint32_t value = 0; - uint32_t rank = 0; - - for (uint32_t i = 1; i < 1000; ++i) { - ASSERT_TRUE(mtf.Insert(i)); - ASSERT_EQ(i, mtf.GetSize()); - - ASSERT_TRUE(mtf.RankFromValue(i, &rank)); - ASSERT_EQ(1u, rank); - - ASSERT_TRUE(mtf.ValueFromRank(1, &value)); - ASSERT_EQ(i, value); - } - - ASSERT_TRUE(mtf.ValueFromRank(999, &value)); - ASSERT_EQ(1u, value); - - ASSERT_TRUE(mtf.ValueFromRank(999, &value)); - ASSERT_EQ(2u, value); - - ASSERT_TRUE(mtf.ValueFromRank(999, &value)); - ASSERT_EQ(3u, value); - - ASSERT_TRUE(mtf.ValueFromRank(999, &value)); - ASSERT_EQ(4u, value); - - ASSERT_TRUE(mtf.ValueFromRank(999, &value)); - ASSERT_EQ(5u, value); - - ASSERT_TRUE(mtf.ValueFromRank(999, &value)); - ASSERT_EQ(6u, value); - - ASSERT_TRUE(mtf.ValueFromRank(101, &value)); - ASSERT_EQ(905u, value); - - ASSERT_TRUE(mtf.ValueFromRank(101, &value)); - ASSERT_EQ(906u, value); - - ASSERT_TRUE(mtf.ValueFromRank(101, &value)); - ASSERT_EQ(907u, value); - - ASSERT_TRUE(mtf.ValueFromRank(201, &value)); - ASSERT_EQ(805u, value); - - ASSERT_TRUE(mtf.ValueFromRank(201, &value)); - ASSERT_EQ(806u, value); - - ASSERT_TRUE(mtf.ValueFromRank(201, &value)); - ASSERT_EQ(807u, value); - - ASSERT_TRUE(mtf.ValueFromRank(301, &value)); - ASSERT_EQ(705u, value); - - ASSERT_TRUE(mtf.ValueFromRank(301, &value)); - ASSERT_EQ(706u, value); - - ASSERT_TRUE(mtf.ValueFromRank(301, &value)); - ASSERT_EQ(707u, value); - - ASSERT_TRUE(mtf.RankFromValue(605, &rank)); - ASSERT_EQ(401u, rank); - - ASSERT_TRUE(mtf.RankFromValue(606, &rank)); - ASSERT_EQ(401u, rank); - - ASSERT_TRUE(mtf.RankFromValue(607, &rank)); - ASSERT_EQ(401u, rank); - - ASSERT_TRUE(mtf.ValueFromRank(1, &value)); - ASSERT_EQ(607u, value); - - ASSERT_TRUE(mtf.ValueFromRank(2, &value)); - ASSERT_EQ(606u, value); - - ASSERT_TRUE(mtf.ValueFromRank(3, &value)); - ASSERT_EQ(605u, value); - - ASSERT_TRUE(mtf.ValueFromRank(4, &value)); - ASSERT_EQ(707u, value); - - ASSERT_TRUE(mtf.ValueFromRank(5, &value)); - ASSERT_EQ(706u, value); - - ASSERT_TRUE(mtf.ValueFromRank(6, &value)); - ASSERT_EQ(705u, value); - - ASSERT_TRUE(mtf.ValueFromRank(7, &value)); - ASSERT_EQ(807u, value); - - ASSERT_TRUE(mtf.ValueFromRank(8, &value)); - ASSERT_EQ(806u, value); - - ASSERT_TRUE(mtf.ValueFromRank(9, &value)); - ASSERT_EQ(805u, value); - - ASSERT_TRUE(mtf.ValueFromRank(10, &value)); - ASSERT_EQ(907u, value); - - ASSERT_TRUE(mtf.ValueFromRank(11, &value)); - ASSERT_EQ(906u, value); - - ASSERT_TRUE(mtf.ValueFromRank(12, &value)); - ASSERT_EQ(905u, value); - - ASSERT_TRUE(mtf.ValueFromRank(13, &value)); - ASSERT_EQ(6u, value); - - ASSERT_TRUE(mtf.ValueFromRank(14, &value)); - ASSERT_EQ(5u, value); - - ASSERT_TRUE(mtf.ValueFromRank(15, &value)); - ASSERT_EQ(4u, value); - - ASSERT_TRUE(mtf.ValueFromRank(16, &value)); - ASSERT_EQ(3u, value); - - ASSERT_TRUE(mtf.ValueFromRank(17, &value)); - ASSERT_EQ(2u, value); - - ASSERT_TRUE(mtf.ValueFromRank(18, &value)); - ASSERT_EQ(1u, value); - - ASSERT_TRUE(mtf.ValueFromRank(19, &value)); - ASSERT_EQ(999u, value); - - ASSERT_TRUE(mtf.ValueFromRank(20, &value)); - ASSERT_EQ(998u, value); - - ASSERT_TRUE(mtf.ValueFromRank(21, &value)); - ASSERT_EQ(997u, value); - - ASSERT_TRUE(mtf.RankFromValue(997, &rank)); - ASSERT_EQ(1u, rank); - - ASSERT_TRUE(mtf.RankFromValue(998, &rank)); - ASSERT_EQ(2u, rank); - - ASSERT_TRUE(mtf.RankFromValue(996, &rank)); - ASSERT_EQ(22u, rank); - - ASSERT_TRUE(mtf.Remove(995)); - - ASSERT_TRUE(mtf.RankFromValue(994, &rank)); - ASSERT_EQ(23u, rank); - - for (uint32_t i = 10; i < 1000; ++i) { - if (i != 995) { - ASSERT_TRUE(mtf.Remove(i)); - } else { - ASSERT_FALSE(mtf.Remove(i)); - } - } - - CheckTree(mtf, - std::string(R"( -6H4S9T1029----8H2S3T8-------7H1S1T7-------D3 - 9H1S1T9-------D3 - 2H3S5T1033----4H2S3T1031----5H1S1T1030----D4 - 3H1S1T1032----D4 - 1H1S1T1034----D3 -)") - .substr(1), - /* print_timestamp = */ true); - - ASSERT_TRUE(mtf.Insert(1000)); - ASSERT_TRUE(mtf.ValueFromRank(1, &value)); - ASSERT_EQ(1000u, value); -} - -} // namespace -} // namespace comp -} // namespace spvtools diff --git a/test/stats/CMakeLists.txt b/test/stats/CMakeLists.txt deleted file mode 100644 index 393cb246d..000000000 --- a/test/stats/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set(VAL_TEST_COMMON_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/../test_fixture.h - ${CMAKE_CURRENT_SOURCE_DIR}/../unit_spirv.h -) - -add_spvtools_unittest(TARGET stats - SRCS stats_aggregate_test.cpp - stats_analyzer_test.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/stats/spirv_stats.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/stats/stats_analyzer.cpp - ${VAL_TEST_COMMON_SRCS} - LIBS ${SPIRV_TOOLS} -) diff --git a/test/stats/stats_aggregate_test.cpp b/test/stats/stats_aggregate_test.cpp deleted file mode 100644 index 074528543..000000000 --- a/test/stats/stats_aggregate_test.cpp +++ /dev/null @@ -1,438 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Tests for unique type declaration rules validator. - -#include -#include - -#include "test/test_fixture.h" -#include "test/unit_spirv.h" -#include "tools/stats/spirv_stats.h" - -namespace spvtools { -namespace stats { -namespace { - -using spvtest::ScopedContext; - -void DiagnosticsMessageHandler(spv_message_level_t level, const char*, - const spv_position_t& position, - const char* message) { - switch (level) { - case SPV_MSG_FATAL: - case SPV_MSG_INTERNAL_ERROR: - case SPV_MSG_ERROR: - std::cerr << "error: " << position.index << ": " << message << std::endl; - break; - case SPV_MSG_WARNING: - std::cout << "warning: " << position.index << ": " << message - << std::endl; - break; - case SPV_MSG_INFO: - std::cout << "info: " << position.index << ": " << message << std::endl; - break; - default: - break; - } -} - -// Calls AggregateStats for binary compiled from |code|. -void CompileAndAggregateStats(const std::string& code, SpirvStats* stats, - spv_target_env env = SPV_ENV_UNIVERSAL_1_1) { - spvtools::Context ctx(env); - ctx.SetMessageConsumer(DiagnosticsMessageHandler); - spv_binary binary; - ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(ctx.CContext(), code.c_str(), - code.size(), &binary, nullptr)); - - ASSERT_EQ(SPV_SUCCESS, AggregateStats(ctx.CContext(), binary->code, - binary->wordCount, nullptr, stats)); - spvBinaryDestroy(binary); -} - -TEST(AggregateStats, CapabilityHistogram) { - const std::string code1 = R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -)"; - - const std::string code2 = R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -)"; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(4u, stats.capability_hist.size()); - EXPECT_EQ(0u, stats.capability_hist.count(SpvCapabilityShader)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityAddresses)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityKernel)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityGenericPointer)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityLinkage)); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(5u, stats.capability_hist.size()); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityShader)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityAddresses)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityKernel)); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityGenericPointer)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityLinkage)); - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(5u, stats.capability_hist.size()); - EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityShader)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityAddresses)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityKernel)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityGenericPointer)); - EXPECT_EQ(3u, stats.capability_hist.at(SpvCapabilityLinkage)); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(5u, stats.capability_hist.size()); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityShader)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityAddresses)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityKernel)); - EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityGenericPointer)); - EXPECT_EQ(4u, stats.capability_hist.at(SpvCapabilityLinkage)); -} - -TEST(AggregateStats, ExtensionHistogram) { - const std::string code1 = R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpExtension "SPV_KHR_16bit_storage" -OpMemoryModel Physical32 OpenCL -)"; - - const std::string code2 = R"( -OpCapability Shader -OpCapability Linkage -OpExtension "SPV_NV_viewport_array2" -OpExtension "greatest_extension_ever" -OpMemoryModel Logical GLSL450 -)"; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(1u, stats.extension_hist.size()); - EXPECT_EQ(0u, stats.extension_hist.count("SPV_NV_viewport_array2")); - EXPECT_EQ(1u, stats.extension_hist.at("SPV_KHR_16bit_storage")); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(3u, stats.extension_hist.size()); - EXPECT_EQ(1u, stats.extension_hist.at("SPV_NV_viewport_array2")); - EXPECT_EQ(1u, stats.extension_hist.at("SPV_KHR_16bit_storage")); - EXPECT_EQ(1u, stats.extension_hist.at("greatest_extension_ever")); - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(3u, stats.extension_hist.size()); - EXPECT_EQ(1u, stats.extension_hist.at("SPV_NV_viewport_array2")); - EXPECT_EQ(2u, stats.extension_hist.at("SPV_KHR_16bit_storage")); - EXPECT_EQ(1u, stats.extension_hist.at("greatest_extension_ever")); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(3u, stats.extension_hist.size()); - EXPECT_EQ(2u, stats.extension_hist.at("SPV_NV_viewport_array2")); - EXPECT_EQ(2u, stats.extension_hist.at("SPV_KHR_16bit_storage")); - EXPECT_EQ(2u, stats.extension_hist.at("greatest_extension_ever")); -} - -TEST(AggregateStats, VersionHistogram) { - const std::string code1 = R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -)"; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(1u, stats.version_hist.size()); - EXPECT_EQ(1u, stats.version_hist.at(0x00010100)); - - CompileAndAggregateStats(code1, &stats, SPV_ENV_UNIVERSAL_1_0); - EXPECT_EQ(2u, stats.version_hist.size()); - EXPECT_EQ(1u, stats.version_hist.at(0x00010100)); - EXPECT_EQ(1u, stats.version_hist.at(0x00010000)); - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(2u, stats.version_hist.size()); - EXPECT_EQ(2u, stats.version_hist.at(0x00010100)); - EXPECT_EQ(1u, stats.version_hist.at(0x00010000)); - - CompileAndAggregateStats(code1, &stats, SPV_ENV_UNIVERSAL_1_0); - EXPECT_EQ(2u, stats.version_hist.size()); - EXPECT_EQ(2u, stats.version_hist.at(0x00010100)); - EXPECT_EQ(2u, stats.version_hist.at(0x00010000)); -} - -TEST(AggregateStats, GeneratorHistogram) { - const std::string code1 = R"( -OpCapability Shader -OpCapability Linkage -OpMemoryModel Logical GLSL450 -)"; - - const uint32_t kGeneratorKhronosAssembler = SPV_GENERATOR_KHRONOS_ASSEMBLER - << 16; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(1u, stats.generator_hist.size()); - EXPECT_EQ(1u, stats.generator_hist.at(kGeneratorKhronosAssembler)); - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(1u, stats.generator_hist.size()); - EXPECT_EQ(2u, stats.generator_hist.at(kGeneratorKhronosAssembler)); -} - -TEST(AggregateStats, OpcodeHistogram) { - const std::string code1 = R"( -OpCapability Addresses -OpCapability Kernel -OpCapability Int64 -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -%u64 = OpTypeInt 64 0 -%u32 = OpTypeInt 32 0 -%f32 = OpTypeFloat 32 -)"; - - const std::string code2 = R"( -OpCapability Shader -OpCapability Linkage -OpExtension "SPV_NV_viewport_array2" -OpMemoryModel Logical GLSL450 -)"; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(4u, stats.opcode_hist.size()); - EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpCapability)); - EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpMemoryModel)); - EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeInt)); - EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpTypeFloat)); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(5u, stats.opcode_hist.size()); - EXPECT_EQ(6u, stats.opcode_hist.at(SpvOpCapability)); - EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpMemoryModel)); - EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeInt)); - EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpTypeFloat)); - EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpExtension)); - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(5u, stats.opcode_hist.size()); - EXPECT_EQ(10u, stats.opcode_hist.at(SpvOpCapability)); - EXPECT_EQ(3u, stats.opcode_hist.at(SpvOpMemoryModel)); - EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpTypeInt)); - EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeFloat)); - EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpExtension)); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(5u, stats.opcode_hist.size()); - EXPECT_EQ(12u, stats.opcode_hist.at(SpvOpCapability)); - EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpMemoryModel)); - EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpTypeInt)); - EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeFloat)); - EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpExtension)); -} - -TEST(AggregateStats, OpcodeMarkovHistogram) { - const std::string code1 = R"( -OpCapability Shader -OpCapability Linkage -OpExtension "SPV_NV_viewport_array2" -OpMemoryModel Logical GLSL450 -)"; - - const std::string code2 = R"( -OpCapability Addresses -OpCapability Kernel -OpCapability Int64 -OpCapability Linkage -OpMemoryModel Physical32 OpenCL -%u64 = OpTypeInt 64 0 -%u32 = OpTypeInt 32 0 -%f32 = OpTypeFloat 32 -)"; - - SpirvStats stats; - stats.opcode_markov_hist.resize(2); - - CompileAndAggregateStats(code1, &stats); - ASSERT_EQ(2u, stats.opcode_markov_hist.size()); - EXPECT_EQ(2u, stats.opcode_markov_hist[0].size()); - EXPECT_EQ(2u, stats.opcode_markov_hist[0].at(SpvOpCapability).size()); - EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpExtension).size()); - EXPECT_EQ( - 1u, stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpCapability)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpExtension)); - EXPECT_EQ( - 1u, stats.opcode_markov_hist[0].at(SpvOpExtension).at(SpvOpMemoryModel)); - - EXPECT_EQ(1u, stats.opcode_markov_hist[1].size()); - EXPECT_EQ(2u, stats.opcode_markov_hist[1].at(SpvOpCapability).size()); - EXPECT_EQ(1u, - stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpExtension)); - EXPECT_EQ( - 1u, stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpMemoryModel)); - - CompileAndAggregateStats(code2, &stats); - ASSERT_EQ(2u, stats.opcode_markov_hist.size()); - EXPECT_EQ(4u, stats.opcode_markov_hist[0].size()); - EXPECT_EQ(3u, stats.opcode_markov_hist[0].at(SpvOpCapability).size()); - EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpExtension).size()); - EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpMemoryModel).size()); - EXPECT_EQ(2u, stats.opcode_markov_hist[0].at(SpvOpTypeInt).size()); - EXPECT_EQ( - 4u, stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpCapability)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpExtension)); - EXPECT_EQ( - 1u, stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpMemoryModel)); - EXPECT_EQ( - 1u, stats.opcode_markov_hist[0].at(SpvOpExtension).at(SpvOpMemoryModel)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[0].at(SpvOpMemoryModel).at(SpvOpTypeInt)); - EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpTypeInt).at(SpvOpTypeInt)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[0].at(SpvOpTypeInt).at(SpvOpTypeFloat)); - - EXPECT_EQ(3u, stats.opcode_markov_hist[1].size()); - EXPECT_EQ(4u, stats.opcode_markov_hist[1].at(SpvOpCapability).size()); - EXPECT_EQ(1u, stats.opcode_markov_hist[1].at(SpvOpMemoryModel).size()); - EXPECT_EQ(1u, stats.opcode_markov_hist[1].at(SpvOpTypeInt).size()); - EXPECT_EQ( - 2u, stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpCapability)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpExtension)); - EXPECT_EQ( - 2u, stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpMemoryModel)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpTypeInt)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[1].at(SpvOpMemoryModel).at(SpvOpTypeInt)); - EXPECT_EQ(1u, - stats.opcode_markov_hist[1].at(SpvOpTypeInt).at(SpvOpTypeFloat)); -} - -TEST(AggregateStats, ConstantLiteralsHistogram) { - const std::string code1 = R"( -OpCapability Addresses -OpCapability Kernel -OpCapability GenericPointer -OpCapability Linkage -OpCapability Float64 -OpCapability Int16 -OpCapability Int64 -OpMemoryModel Physical32 OpenCL -%u16 = OpTypeInt 16 0 -%u32 = OpTypeInt 32 0 -%u64 = OpTypeInt 64 0 -%f32 = OpTypeFloat 32 -%f64 = OpTypeFloat 64 -%1 = OpConstant %f32 0.1 -%2 = OpConstant %f32 -2 -%3 = OpConstant %f64 -2 -%4 = OpConstant %u16 16 -%5 = OpConstant %u16 2 -%6 = OpConstant %u32 32 -%7 = OpConstant %u64 64 -)"; - - const std::string code2 = R"( -OpCapability Shader -OpCapability Linkage -OpCapability Int16 -OpCapability Int64 -OpMemoryModel Logical GLSL450 -%f32 = OpTypeFloat 32 -%u16 = OpTypeInt 16 0 -%s16 = OpTypeInt 16 1 -%u32 = OpTypeInt 32 0 -%s32 = OpTypeInt 32 1 -%u64 = OpTypeInt 64 0 -%s64 = OpTypeInt 64 1 -%1 = OpConstant %f32 0.1 -%2 = OpConstant %f32 -2 -%3 = OpConstant %u16 1 -%4 = OpConstant %u16 16 -%5 = OpConstant %u16 2 -%6 = OpConstant %s16 -16 -%7 = OpConstant %u32 32 -%8 = OpConstant %s32 2 -%9 = OpConstant %s32 -32 -%10 = OpConstant %u64 64 -%11 = OpConstant %s64 -64 -)"; - - SpirvStats stats; - - CompileAndAggregateStats(code1, &stats); - EXPECT_EQ(2u, stats.f32_constant_hist.size()); - EXPECT_EQ(1u, stats.f64_constant_hist.size()); - EXPECT_EQ(1u, stats.f32_constant_hist.at(0.1f)); - EXPECT_EQ(1u, stats.f32_constant_hist.at(-2.f)); - EXPECT_EQ(1u, stats.f64_constant_hist.at(-2)); - - EXPECT_EQ(2u, stats.u16_constant_hist.size()); - EXPECT_EQ(0u, stats.s16_constant_hist.size()); - EXPECT_EQ(1u, stats.u32_constant_hist.size()); - EXPECT_EQ(0u, stats.s32_constant_hist.size()); - EXPECT_EQ(1u, stats.u64_constant_hist.size()); - EXPECT_EQ(0u, stats.s64_constant_hist.size()); - EXPECT_EQ(1u, stats.u16_constant_hist.at(16)); - EXPECT_EQ(1u, stats.u16_constant_hist.at(2)); - EXPECT_EQ(1u, stats.u32_constant_hist.at(32)); - EXPECT_EQ(1u, stats.u64_constant_hist.at(64)); - - CompileAndAggregateStats(code2, &stats); - EXPECT_EQ(2u, stats.f32_constant_hist.size()); - EXPECT_EQ(1u, stats.f64_constant_hist.size()); - EXPECT_EQ(2u, stats.f32_constant_hist.at(0.1f)); - EXPECT_EQ(2u, stats.f32_constant_hist.at(-2.f)); - EXPECT_EQ(1u, stats.f64_constant_hist.at(-2)); - - EXPECT_EQ(3u, stats.u16_constant_hist.size()); - EXPECT_EQ(1u, stats.s16_constant_hist.size()); - EXPECT_EQ(1u, stats.u32_constant_hist.size()); - EXPECT_EQ(2u, stats.s32_constant_hist.size()); - EXPECT_EQ(1u, stats.u64_constant_hist.size()); - EXPECT_EQ(1u, stats.s64_constant_hist.size()); - EXPECT_EQ(2u, stats.u16_constant_hist.at(16)); - EXPECT_EQ(2u, stats.u16_constant_hist.at(2)); - EXPECT_EQ(1u, stats.u16_constant_hist.at(1)); - EXPECT_EQ(1u, stats.s16_constant_hist.at(-16)); - EXPECT_EQ(2u, stats.u32_constant_hist.at(32)); - EXPECT_EQ(1u, stats.s32_constant_hist.at(2)); - EXPECT_EQ(1u, stats.s32_constant_hist.at(-32)); - EXPECT_EQ(2u, stats.u64_constant_hist.at(64)); - EXPECT_EQ(1u, stats.s64_constant_hist.at(-64)); -} - -} // namespace -} // namespace stats -} // namespace spvtools diff --git a/test/stats/stats_analyzer_test.cpp b/test/stats/stats_analyzer_test.cpp deleted file mode 100644 index 3764c5bdd..000000000 --- a/test/stats/stats_analyzer_test.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Tests for unique type declaration rules validator. - -#include -#include - -#include "source/latest_version_spirv_header.h" -#include "test/test_fixture.h" -#include "tools/stats/stats_analyzer.h" - -namespace spvtools { -namespace stats { -namespace { - -// Fills |stats| with some synthetic header stats, as if aggregated from 100 -// modules (100 used for simpler percentage evaluation). -void FillDefaultStats(SpirvStats* stats) { - *stats = SpirvStats(); - stats->version_hist[0x00010000] = 40; - stats->version_hist[0x00010100] = 60; - stats->generator_hist[0x00000000] = 64; - stats->generator_hist[0x00010000] = 1; - stats->generator_hist[0x00020000] = 2; - stats->generator_hist[0x00030000] = 3; - stats->generator_hist[0x00040000] = 4; - stats->generator_hist[0x00050000] = 5; - stats->generator_hist[0x00060000] = 6; - stats->generator_hist[0x00070000] = 7; - stats->generator_hist[0x00080000] = 8; - - int num_version_entries = 0; - for (const auto& pair : stats->version_hist) { - num_version_entries += pair.second; - } - - int num_generator_entries = 0; - for (const auto& pair : stats->generator_hist) { - num_generator_entries += pair.second; - } - - EXPECT_EQ(num_version_entries, num_generator_entries); -} - -TEST(StatsAnalyzer, Version) { - SpirvStats stats; - FillDefaultStats(&stats); - - StatsAnalyzer analyzer(stats); - - std::stringstream ss; - analyzer.WriteVersion(ss); - const std::string output = ss.str(); - const std::string expected_output = "Version 1.1 60%\nVersion 1.0 40%\n"; - - EXPECT_EQ(expected_output, output); -} - -TEST(StatsAnalyzer, Generator) { - SpirvStats stats; - FillDefaultStats(&stats); - - StatsAnalyzer analyzer(stats); - - std::stringstream ss; - analyzer.WriteGenerator(ss); - const std::string output = ss.str(); - const std::string expected_output = - "Khronos 64%\nKhronos Glslang Reference Front End 8%\n" - "Khronos SPIR-V Tools Assembler 7%\nKhronos LLVM/SPIR-V Translator 6%" - "\nARM 5%\nNVIDIA 4%\nCodeplay 3%\nValve 2%\nLunarG 1%\n"; - - EXPECT_EQ(expected_output, output); -} - -TEST(StatsAnalyzer, Capability) { - SpirvStats stats; - FillDefaultStats(&stats); - - stats.capability_hist[SpvCapabilityShader] = 25; - stats.capability_hist[SpvCapabilityKernel] = 75; - - StatsAnalyzer analyzer(stats); - - std::stringstream ss; - analyzer.WriteCapability(ss); - const std::string output = ss.str(); - const std::string expected_output = "Kernel 75%\nShader 25%\n"; - - EXPECT_EQ(expected_output, output); -} - -TEST(StatsAnalyzer, Extension) { - SpirvStats stats; - FillDefaultStats(&stats); - - stats.extension_hist["greatest_extension_ever"] = 1; - stats.extension_hist["worst_extension_ever"] = 10; - - StatsAnalyzer analyzer(stats); - - std::stringstream ss; - analyzer.WriteExtension(ss); - const std::string output = ss.str(); - const std::string expected_output = - "worst_extension_ever 10%\ngreatest_extension_ever 1%\n"; - - EXPECT_EQ(expected_output, output); -} - -TEST(StatsAnalyzer, Opcode) { - SpirvStats stats; - FillDefaultStats(&stats); - - stats.opcode_hist[SpvOpCapability] = 20; - stats.opcode_hist[SpvOpConstant] = 80; - stats.opcode_hist[SpvOpDecorate] = 100; - - StatsAnalyzer analyzer(stats); - - std::stringstream ss; - analyzer.WriteOpcode(ss); - const std::string output = ss.str(); - const std::string expected_output = - "Total unique opcodes used: 3\nDecorate 50%\n" - "Constant 40%\nCapability 10%\n"; - - EXPECT_EQ(expected_output, output); -} - -TEST(StatsAnalyzer, OpcodeMarkov) { - SpirvStats stats; - FillDefaultStats(&stats); - - stats.opcode_hist[SpvOpFMul] = 400; - stats.opcode_hist[SpvOpFAdd] = 200; - stats.opcode_hist[SpvOpFSub] = 400; - - stats.opcode_markov_hist.resize(1); - auto& hist = stats.opcode_markov_hist[0]; - hist[SpvOpFMul][SpvOpFAdd] = 100; - hist[SpvOpFMul][SpvOpFSub] = 300; - hist[SpvOpFAdd][SpvOpFMul] = 100; - hist[SpvOpFAdd][SpvOpFAdd] = 100; - - StatsAnalyzer analyzer(stats); - - std::stringstream ss; - analyzer.WriteOpcodeMarkov(ss); - const std::string output = ss.str(); - const std::string expected_output = - "FMul -> FSub 75% (base rate 40%, pair occurrences 300)\n" - "FMul -> FAdd 25% (base rate 20%, pair occurrences 100)\n" - "FAdd -> FAdd 50% (base rate 20%, pair occurrences 100)\n" - "FAdd -> FMul 50% (base rate 40%, pair occurrences 100)\n"; - - EXPECT_EQ(expected_output, output); -} - -} // namespace -} // namespace stats -} // namespace spvtools diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index bce6f1bbf..b1f741cf8 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -48,13 +48,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS}) endif() add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS}) - add_spvtools_tool(TARGET spirv-stats - SRCS stats/stats.cpp - stats/stats_analyzer.cpp - stats/stats_analyzer.h - stats/spirv_stats.cpp - stats/spirv_stats.h - LIBS ${SPIRV_TOOLS}) add_spvtools_tool(TARGET spirv-cfg SRCS cfg/cfg.cpp cfg/bin_to_dot.h @@ -62,26 +55,12 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES}) LIBS ${SPIRV_TOOLS}) target_include_directories(spirv-cfg PRIVATE ${spirv-tools_SOURCE_DIR} ${SPIRV_HEADER_INCLUDE_DIR}) - target_include_directories(spirv-stats PRIVATE ${spirv-tools_SOURCE_DIR} - ${SPIRV_HEADER_INCLUDE_DIR}) - - set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt spirv-stats + set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt spirv-cfg spirv-link) if(NOT DEFINED IOS_PLATFORM) set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce) endif() - if(SPIRV_BUILD_COMPRESSION) - add_spvtools_tool(TARGET spirv-markv - SRCS comp/markv.cpp - comp/markv_model_factory.cpp - comp/markv_model_shader.cpp - LIBS SPIRV-Tools-comp SPIRV-Tools-opt ${SPIRV_TOOLS}) - target_include_directories(spirv-markv PRIVATE ${spirv-tools_SOURCE_DIR} - ${SPIRV_HEADER_INCLUDE_DIR}) - set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-markv) - endif(SPIRV_BUILD_COMPRESSION) - if(ENABLE_SPIRV_TOOLS_INSTALL) install(TARGETS ${SPIRV_INSTALL_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/tools/comp/markv.cpp b/tools/comp/markv.cpp deleted file mode 100644 index 9a0a51808..000000000 --- a/tools/comp/markv.cpp +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "source/comp/markv.h" -#include "source/spirv_target_env.h" -#include "source/table.h" -#include "spirv-tools/optimizer.hpp" -#include "tools/comp/markv_model_factory.h" -#include "tools/io.h" - -namespace { - -const auto kSpvEnv = SPV_ENV_UNIVERSAL_1_2; - -enum Task { - kNoTask = 0, - kEncode, - kDecode, - kTest, -}; - -struct ScopedContext { - ScopedContext(spv_target_env env) : context(spvContextCreate(env)) {} - ~ScopedContext() { spvContextDestroy(context); } - spv_context context; -}; - -void print_usage(char* argv0) { - printf( - R"(%s - Encodes or decodes a SPIR-V binary to or from a MARK-V binary. - -USAGE: %s [e|d|t] [options] [] - -The input binary is read from . If no file is specified, -or if the filename is "-", then the binary is read from standard input. - -If no output is specified then the output is printed to stdout in a human -readable format. - -WIP: MARK-V codec is in early stages of development. At the moment it only -can encode and decode some SPIR-V files and only if exacly the same build of -software is used (is doesn't write or handle version numbers yet). - -Tasks: - e Encode SPIR-V to MARK-V. - d Decode MARK-V to SPIR-V. - t Test the codec by first encoding the given SPIR-V file to - MARK-V, then decoding it back to SPIR-V and comparing results. - -Options: - -h, --help Print this help. - --comments Write codec comments to stderr. - --version Display MARK-V codec version. - --validate Validate SPIR-V while encoding or decoding. - --model= - Compression model, possible values: - shader_lite - fast, poor compression ratio - shader_mid - balanced - shader_max - best compression ratio - Default: shader_lite - - -o Set the output filename. - Output goes to standard output if this option is - not specified, or if the filename is "-". - Not needed for 't' task (testing). -)", - argv0, argv0); -} - -void DiagnosticsMessageHandler(spv_message_level_t level, const char*, - const spv_position_t& position, - const char* message) { - switch (level) { - case SPV_MSG_FATAL: - case SPV_MSG_INTERNAL_ERROR: - case SPV_MSG_ERROR: - std::cerr << "error: " << position.index << ": " << message << std::endl; - break; - case SPV_MSG_WARNING: - std::cerr << "warning: " << position.index << ": " << message - << std::endl; - break; - case SPV_MSG_INFO: - std::cerr << "info: " << position.index << ": " << message << std::endl; - break; - default: - break; - } -} - -} // namespace - -int main(int argc, char** argv) { - const char* input_filename = nullptr; - const char* output_filename = nullptr; - - Task task = kNoTask; - - if (argc < 3) { - print_usage(argv[0]); - return 0; - } - - const char* task_char = argv[1]; - if (0 == strcmp("e", task_char)) { - task = kEncode; - } else if (0 == strcmp("d", task_char)) { - task = kDecode; - } else if (0 == strcmp("t", task_char)) { - task = kTest; - } - - if (task == kNoTask) { - print_usage(argv[0]); - return 1; - } - - bool want_comments = false; - bool validate_spirv_binary = false; - - spvtools::comp::MarkvModelType model_type = - spvtools::comp::kMarkvModelUnknown; - - for (int argi = 2; argi < argc; ++argi) { - if ('-' == argv[argi][0]) { - switch (argv[argi][1]) { - case 'h': - print_usage(argv[0]); - return 0; - case 'o': { - if (!output_filename && argi + 1 < argc && - (task == kEncode || task == kDecode)) { - output_filename = argv[++argi]; - } else { - print_usage(argv[0]); - return 1; - } - } break; - case '-': { - if (0 == strcmp(argv[argi], "--help")) { - print_usage(argv[0]); - return 0; - } else if (0 == strcmp(argv[argi], "--comments")) { - want_comments = true; - } else if (0 == strcmp(argv[argi], "--version")) { - fprintf(stderr, "error: Not implemented\n"); - return 1; - } else if (0 == strcmp(argv[argi], "--validate")) { - validate_spirv_binary = true; - } else if (0 == strcmp(argv[argi], "--model=shader_lite")) { - if (model_type != spvtools::comp::kMarkvModelUnknown) - fprintf(stderr, "error: More than one model specified\n"); - model_type = spvtools::comp::kMarkvModelShaderLite; - } else if (0 == strcmp(argv[argi], "--model=shader_mid")) { - if (model_type != spvtools::comp::kMarkvModelUnknown) - fprintf(stderr, "error: More than one model specified\n"); - model_type = spvtools::comp::kMarkvModelShaderMid; - } else if (0 == strcmp(argv[argi], "--model=shader_max")) { - if (model_type != spvtools::comp::kMarkvModelUnknown) - fprintf(stderr, "error: More than one model specified\n"); - model_type = spvtools::comp::kMarkvModelShaderMax; - } else { - print_usage(argv[0]); - return 1; - } - } break; - case '\0': { - // Setting a filename of "-" to indicate stdin. - if (!input_filename) { - input_filename = argv[argi]; - } else { - fprintf(stderr, "error: More than one input file specified\n"); - return 1; - } - } break; - default: - print_usage(argv[0]); - return 1; - } - } else { - if (!input_filename) { - input_filename = argv[argi]; - } else { - fprintf(stderr, "error: More than one input file specified\n"); - return 1; - } - } - } - - if (model_type == spvtools::comp::kMarkvModelUnknown) - model_type = spvtools::comp::kMarkvModelShaderLite; - - const auto no_comments = spvtools::comp::MarkvLogConsumer(); - const auto output_to_stderr = [](const std::string& str) { - std::cerr << str; - }; - - ScopedContext ctx(kSpvEnv); - - std::unique_ptr model = - spvtools::comp::CreateMarkvModel(model_type); - - std::vector spirv; - std::vector markv; - - spvtools::comp::MarkvCodecOptions options; - options.validate_spirv_binary = validate_spirv_binary; - - if (task == kEncode) { - if (!ReadFile(input_filename, "rb", &spirv)) return 1; - assert(!spirv.empty()); - - if (SPV_SUCCESS != spvtools::comp::SpirvToMarkv( - ctx.context, spirv, options, *model, - DiagnosticsMessageHandler, - want_comments ? output_to_stderr : no_comments, - spvtools::comp::MarkvDebugConsumer(), &markv)) { - std::cerr << "error: Failed to encode " << input_filename << " to MARK-V " - << std::endl; - return 1; - } - - if (!WriteFile(output_filename, "wb", markv.data(), markv.size())) - return 1; - } else if (task == kDecode) { - if (!ReadFile(input_filename, "rb", &markv)) return 1; - assert(!markv.empty()); - - if (SPV_SUCCESS != spvtools::comp::MarkvToSpirv( - ctx.context, markv, options, *model, - DiagnosticsMessageHandler, - want_comments ? output_to_stderr : no_comments, - spvtools::comp::MarkvDebugConsumer(), &spirv)) { - std::cerr << "error: Failed to decode " << input_filename << " to SPIR-V " - << std::endl; - return 1; - } - - if (!WriteFile(output_filename, "wb", spirv.data(), spirv.size())) - return 1; - } else if (task == kTest) { - if (!ReadFile(input_filename, "rb", &spirv)) return 1; - assert(!spirv.empty()); - - std::vector spirv_before; - spvtools::Optimizer optimizer(kSpvEnv); - optimizer.RegisterPass(spvtools::CreateCompactIdsPass()); - if (!optimizer.Run(spirv.data(), spirv.size(), &spirv_before)) { - std::cerr << "error: Optimizer failure on: " << input_filename - << std::endl; - } - - std::vector encoder_instruction_bits; - std::vector encoder_instruction_comments; - std::vector> encoder_instruction_words; - std::vector decoder_instruction_bits; - std::vector decoder_instruction_comments; - std::vector> decoder_instruction_words; - - const auto encoder_debug_consumer = [&](const std::vector& words, - const std::string& bits, - const std::string& comment) { - encoder_instruction_words.push_back(words); - encoder_instruction_bits.push_back(bits); - encoder_instruction_comments.push_back(comment); - return true; - }; - - if (SPV_SUCCESS != spvtools::comp::SpirvToMarkv( - ctx.context, spirv_before, options, *model, - DiagnosticsMessageHandler, - want_comments ? output_to_stderr : no_comments, - encoder_debug_consumer, &markv)) { - std::cerr << "error: Failed to encode " << input_filename << " to MARK-V " - << std::endl; - return 1; - } - - const auto write_bug_report = [&]() { - for (size_t inst_index = 0; inst_index < decoder_instruction_words.size(); - ++inst_index) { - std::cerr << "\nInstruction #" << inst_index << std::endl; - std::cerr << "\nEncoder words: "; - for (uint32_t word : encoder_instruction_words[inst_index]) - std::cerr << word << " "; - std::cerr << "\nDecoder words: "; - for (uint32_t word : decoder_instruction_words[inst_index]) - std::cerr << word << " "; - std::cerr << std::endl; - - std::cerr << "\nEncoder bits: " << encoder_instruction_bits[inst_index]; - std::cerr << "\nDecoder bits: " << decoder_instruction_bits[inst_index]; - std::cerr << std::endl; - - std::cerr << "\nEncoder comments:\n" - << encoder_instruction_comments[inst_index]; - std::cerr << "Decoder comments:\n" - << decoder_instruction_comments[inst_index]; - std::cerr << std::endl; - } - }; - - const auto decoder_debug_consumer = [&](const std::vector& words, - const std::string& bits, - const std::string& comment) { - const size_t inst_index = decoder_instruction_words.size(); - if (inst_index >= encoder_instruction_words.size()) { - write_bug_report(); - std::cerr << "error: Decoder has more instructions than encoder: " - << input_filename << std::endl; - return false; - } - - decoder_instruction_words.push_back(words); - decoder_instruction_bits.push_back(bits); - decoder_instruction_comments.push_back(comment); - - if (encoder_instruction_words[inst_index] != - decoder_instruction_words[inst_index]) { - write_bug_report(); - std::cerr << "error: Words of the last decoded instruction differ from " - "reference: " - << input_filename << std::endl; - return false; - } - - if (encoder_instruction_bits[inst_index] != - decoder_instruction_bits[inst_index]) { - write_bug_report(); - std::cerr << "error: Bits of the last decoded instruction differ from " - "reference: " - << input_filename << std::endl; - return false; - } - return true; - }; - - std::vector spirv_after; - const spv_result_t decoding_result = spvtools::comp::MarkvToSpirv( - ctx.context, markv, options, *model, DiagnosticsMessageHandler, - want_comments ? output_to_stderr : no_comments, decoder_debug_consumer, - &spirv_after); - - if (decoding_result == SPV_REQUESTED_TERMINATION) { - std::cerr << "error: Decoding interrupted by the debugger: " - << input_filename << std::endl; - return 1; - } - - if (decoding_result != SPV_SUCCESS) { - std::cerr << "error: Failed to decode encoded " << input_filename - << " back to SPIR-V " << std::endl; - return 1; - } - - assert(spirv_before.size() == spirv_after.size()); - assert(std::mismatch(std::next(spirv_before.begin(), 5), spirv_before.end(), - std::next(spirv_after.begin(), 5)) == - std::make_pair(spirv_before.end(), spirv_after.end())); - } - - return 0; -} diff --git a/tools/comp/markv_model_factory.cpp b/tools/comp/markv_model_factory.cpp deleted file mode 100644 index 863fcf558..000000000 --- a/tools/comp/markv_model_factory.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "tools/comp/markv_model_factory.h" - -#include "source/util/make_unique.h" -#include "tools/comp/markv_model_shader.h" - -namespace spvtools { -namespace comp { - -std::unique_ptr CreateMarkvModel(MarkvModelType type) { - std::unique_ptr model; - switch (type) { - case kMarkvModelShaderLite: { - model = MakeUnique(); - break; - } - case kMarkvModelShaderMid: { - model = MakeUnique(); - break; - } - case kMarkvModelShaderMax: { - model = MakeUnique(); - break; - } - case kMarkvModelUnknown: { - assert(0 && "kMarkvModelUnknown supplied to CreateMarkvModel"); - return model; - } - } - - model->SetModelType(static_cast(type)); - - return model; -} - -} // namespace comp -} // namespace spvtools diff --git a/tools/comp/markv_model_factory.h b/tools/comp/markv_model_factory.h deleted file mode 100644 index c13898b98..000000000 --- a/tools/comp/markv_model_factory.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef TOOLS_COMP_MARKV_MODEL_FACTORY_H_ -#define TOOLS_COMP_MARKV_MODEL_FACTORY_H_ - -#include - -#include "source/comp/markv_model.h" - -namespace spvtools { -namespace comp { - -enum MarkvModelType { - kMarkvModelUnknown = 0, - kMarkvModelShaderLite, - kMarkvModelShaderMid, - kMarkvModelShaderMax, -}; - -std::unique_ptr CreateMarkvModel(MarkvModelType type); - -} // namespace comp -} // namespace spvtools - -#endif // TOOLS_COMP_MARKV_MODEL_FACTORY_H_ diff --git a/tools/comp/markv_model_shader.cpp b/tools/comp/markv_model_shader.cpp deleted file mode 100644 index 8e296cd8c..000000000 --- a/tools/comp/markv_model_shader.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "tools/comp/markv_model_shader.h" - -#include -#include -#include -#include -#include -#include - -#include "source/util/make_unique.h" - -namespace spvtools { -namespace comp { -namespace { - -// Signals that the value is not in the coding scheme and a fallback method -// needs to be used. -const uint64_t kMarkvNoneOfTheAbove = MarkvModel::GetMarkvNoneOfTheAbove(); - -inline uint32_t CombineOpcodeAndNumOperands(uint32_t opcode, - uint32_t num_operands) { - return opcode | (num_operands << 16); -} - -#include "tools/comp/markv_model_shader_default_autogen.inc" - -} // namespace - -MarkvModelShaderLite::MarkvModelShaderLite() { - const uint16_t kVersionNumber = 1; - SetModelVersion(kVersionNumber); - - opcode_and_num_operands_huffman_codec_ = - MakeUnique>(GetOpcodeAndNumOperandsHist()); - - id_fallback_strategy_ = IdFallbackStrategy::kShortDescriptor; -} - -MarkvModelShaderMid::MarkvModelShaderMid() { - const uint16_t kVersionNumber = 1; - SetModelVersion(kVersionNumber); - - opcode_and_num_operands_huffman_codec_ = - MakeUnique>(GetOpcodeAndNumOperandsHist()); - non_id_word_huffman_codecs_ = GetNonIdWordHuffmanCodecs(); - id_descriptor_huffman_codecs_ = GetIdDescriptorHuffmanCodecs(); - descriptors_with_coding_scheme_ = GetDescriptorsWithCodingScheme(); - literal_string_huffman_codecs_ = GetLiteralStringHuffmanCodecs(); - - id_fallback_strategy_ = IdFallbackStrategy::kShortDescriptor; -} - -MarkvModelShaderMax::MarkvModelShaderMax() { - const uint16_t kVersionNumber = 1; - SetModelVersion(kVersionNumber); - - opcode_and_num_operands_huffman_codec_ = - MakeUnique>(GetOpcodeAndNumOperandsHist()); - opcode_and_num_operands_markov_huffman_codecs_ = - GetOpcodeAndNumOperandsMarkovHuffmanCodecs(); - non_id_word_huffman_codecs_ = GetNonIdWordHuffmanCodecs(); - id_descriptor_huffman_codecs_ = GetIdDescriptorHuffmanCodecs(); - descriptors_with_coding_scheme_ = GetDescriptorsWithCodingScheme(); - literal_string_huffman_codecs_ = GetLiteralStringHuffmanCodecs(); - - id_fallback_strategy_ = IdFallbackStrategy::kRuleBased; -} - -} // namespace comp -} // namespace spvtools diff --git a/tools/comp/markv_model_shader.h b/tools/comp/markv_model_shader.h deleted file mode 100644 index 3a704571f..000000000 --- a/tools/comp/markv_model_shader.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef TOOLS_COMP_MARKV_MODEL_SHADER_H_ -#define TOOLS_COMP_MARKV_MODEL_SHADER_H_ - -#include "source/comp/markv_model.h" - -namespace spvtools { -namespace comp { - -// MARK-V shader compression model, which only uses fast and lightweight -// algorithms, which do not require training and are not heavily dependent on -// SPIR-V grammar. Compression ratio is worse than by other models. -class MarkvModelShaderLite : public MarkvModel { - public: - MarkvModelShaderLite(); -}; - -// MARK-V shader compression model with balanced compression ratio and runtime -// performance. -class MarkvModelShaderMid : public MarkvModel { - public: - MarkvModelShaderMid(); -}; - -// MARK-V shader compression model designed for maximum compression. -class MarkvModelShaderMax : public MarkvModel { - public: - MarkvModelShaderMax(); -}; - -} // namespace comp -} // namespace spvtools - -#endif // TOOLS_COMP_MARKV_MODEL_SHADER_H_ diff --git a/tools/comp/markv_model_shader_default_autogen.inc b/tools/comp/markv_model_shader_default_autogen.inc deleted file mode 100644 index 0093cf1c0..000000000 --- a/tools/comp/markv_model_shader_default_autogen.inc +++ /dev/null @@ -1,14519 +0,0 @@ - -std::map GetOpcodeAndNumOperandsHist() { - return std::map({ - { CombineOpcodeAndNumOperands(SpvOpExtInst, 7), 158282 }, - { CombineOpcodeAndNumOperands(SpvOpDot, 4), 151035 }, - { CombineOpcodeAndNumOperands(SpvOpVectorShuffle, 6), 183292 }, - { CombineOpcodeAndNumOperands(SpvOpImageSampleImplicitLod, 4), 126492 }, - { CombineOpcodeAndNumOperands(SpvOpExecutionMode, 2), 13311 }, - { CombineOpcodeAndNumOperands(SpvOpFNegate, 3), 29952 }, - { CombineOpcodeAndNumOperands(SpvOpExtInst, 5), 106847 }, - { CombineOpcodeAndNumOperands(SpvOpImageSampleExplicitLod, 7), 26350 }, - { CombineOpcodeAndNumOperands(SpvOpImageSampleExplicitLod, 6), 28186 }, - { CombineOpcodeAndNumOperands(SpvOpFDiv, 4), 41635 }, - { CombineOpcodeAndNumOperands(SpvOpFMul, 4), 412786 }, - { CombineOpcodeAndNumOperands(SpvOpFunction, 4), 62905 }, - { CombineOpcodeAndNumOperands(SpvOpVectorShuffle, 8), 118614 }, - { CombineOpcodeAndNumOperands(SpvOpDecorate, 2), 100735 }, - { CombineOpcodeAndNumOperands(SpvOpReturnValue, 1), 40852 }, - { CombineOpcodeAndNumOperands(SpvOpVectorTimesScalar, 4), 157091 }, - { CombineOpcodeAndNumOperands(SpvOpExtInst, 6), 122100 }, - { CombineOpcodeAndNumOperands(SpvOpAccessChain, 5), 82930 }, - { CombineOpcodeAndNumOperands(SpvOpFSub, 4), 161019 }, - { CombineOpcodeAndNumOperands(SpvOpConstant, 3), 466014 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeExtract, 5), 107126 }, - { CombineOpcodeAndNumOperands(SpvOpTypeImage, 8), 34775 }, - { CombineOpcodeAndNumOperands(SpvOpImageSampleDrefExplicitLod, 7), 26146 }, - { CombineOpcodeAndNumOperands(SpvOpMemoryModel, 2), 18879 }, - { CombineOpcodeAndNumOperands(SpvOpDecorate, 3), 485251 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeConstruct, 4), 78011 }, - { CombineOpcodeAndNumOperands(SpvOpTypeFloat, 2), 18879 }, - { CombineOpcodeAndNumOperands(SpvOpVectorTimesMatrix, 4), 15848 }, - { CombineOpcodeAndNumOperands(SpvOpTypeVector, 3), 69404 }, - { CombineOpcodeAndNumOperands(SpvOpTypeFunction, 3), 19998 }, - { CombineOpcodeAndNumOperands(SpvOpConstantComposite, 6), 40228 }, - { CombineOpcodeAndNumOperands(SpvOpCapability, 1), 22510 }, - { CombineOpcodeAndNumOperands(SpvOpTypeArray, 3), 37585 }, - { CombineOpcodeAndNumOperands(SpvOpTypeInt, 3), 30454 }, - { CombineOpcodeAndNumOperands(SpvOpFunctionCall, 4), 29021 }, - { CombineOpcodeAndNumOperands(SpvOpFAdd, 4), 342237 }, - { CombineOpcodeAndNumOperands(SpvOpTypeMatrix, 3), 24449 }, - { CombineOpcodeAndNumOperands(SpvOpLabel, 1), 129408 }, - { CombineOpcodeAndNumOperands(SpvOpTypePointer, 3), 246535 }, - { CombineOpcodeAndNumOperands(SpvOpAccessChain, 4), 503456 }, - { CombineOpcodeAndNumOperands(SpvOpTypeFunction, 2), 19779 }, - { CombineOpcodeAndNumOperands(SpvOpBranchConditional, 3), 24139 }, - { CombineOpcodeAndNumOperands(SpvOpVariable, 3), 697946 }, - { CombineOpcodeAndNumOperands(SpvOpConstantComposite, 5), 55769 }, - { CombineOpcodeAndNumOperands(SpvOpTypeVoid, 1), 18879 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeConstruct, 6), 145508 }, - { CombineOpcodeAndNumOperands(SpvOpFunctionParameter, 2), 85583 }, - { CombineOpcodeAndNumOperands(SpvOpTypeSampledImage, 2), 34775 }, - { CombineOpcodeAndNumOperands(SpvOpConstantComposite, 4), 66362 }, - { CombineOpcodeAndNumOperands(SpvOpLoad, 3), 1272902 }, - { CombineOpcodeAndNumOperands(SpvOpReturn, 0), 22122 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeExtract, 4), 861008 }, - { CombineOpcodeAndNumOperands(SpvOpFunctionEnd, 0), 62905 }, - { CombineOpcodeAndNumOperands(SpvOpExtInstImport, 2), 18879 }, - { CombineOpcodeAndNumOperands(SpvOpSelectionMerge, 2), 22009 }, - { CombineOpcodeAndNumOperands(SpvOpBranch, 1), 38275 }, - { CombineOpcodeAndNumOperands(SpvOpTypeBool, 1), 12208 }, - { CombineOpcodeAndNumOperands(SpvOpSampledImage, 4), 95518 }, - { CombineOpcodeAndNumOperands(SpvOpMemberDecorate, 3), 94887 }, - { CombineOpcodeAndNumOperands(SpvOpMemberDecorate, 4), 1942215 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeConstruct, 5), 205266 }, - { CombineOpcodeAndNumOperands(SpvOpUndef, 2), 22157 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeInsert, 5), 142749 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeInsert, 6), 24420 }, - { CombineOpcodeAndNumOperands(SpvOpCompositeExtract, 6), 16896 }, - { CombineOpcodeAndNumOperands(SpvOpStore, 2), 604982 }, - { CombineOpcodeAndNumOperands(SpvOpIAdd, 4), 14471 }, - { CombineOpcodeAndNumOperands(SpvOpVectorShuffle, 7), 269658 }, - { kMarkvNoneOfTheAbove, 399895 }, - }); -} - -std::map>> -GetOpcodeAndNumOperandsMarkovHuffmanCodecs() { - std::map>> codecs; - { - std::unique_ptr> codec(new HuffmanCodec(35, { - {0, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {262209, 0, 0}, - {262221, 0, 0}, - {262225, 0, 0}, - {262230, 0, 0}, - {262273, 0, 0}, - {262277, 0, 0}, - {262286, 0, 0}, - {327745, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393295, 0, 0}, - {393304, 0, 0}, - {458831, 0, 0}, - {458840, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 11, 8}, - {0, 12, 19}, - {0, 18, 20}, - {0, 5, 21}, - {0, 15, 7}, - {0, 10, 1}, - {0, 23, 22}, - {0, 14, 24}, - {0, 6, 4}, - {0, 2, 17}, - {0, 13, 25}, - {0, 9, 26}, - {0, 28, 27}, - {0, 3, 29}, - {0, 30, 16}, - {0, 32, 31}, - {0, 34, 33}, - })); - - codecs.emplace(SpvOpImageSampleExplicitLod, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(55, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393303, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 14, 5}, - {0, 29, 17}, - {0, 1, 30}, - {0, 10, 20}, - {0, 32, 31}, - {0, 33, 2}, - {0, 34, 23}, - {0, 8, 35}, - {0, 6, 36}, - {0, 19, 22}, - {0, 28, 25}, - {0, 38, 37}, - {0, 13, 39}, - {0, 40, 24}, - {0, 27, 21}, - {0, 26, 41}, - {0, 42, 12}, - {0, 15, 43}, - {0, 44, 18}, - {0, 45, 3}, - {0, 11, 7}, - {0, 16, 46}, - {0, 47, 9}, - {0, 4, 48}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - })); - - codecs.emplace(SpvOpFDiv, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(19, { - {0, 0, 0}, - {196669, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262286, 0, 0}, - {393295, 0, 0}, - {393304, 0, 0}, - {458840, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 10}, - {0, 11, 3}, - {0, 2, 9}, - {0, 4, 1}, - {0, 5, 6}, - {0, 13, 12}, - {0, 15, 14}, - {0, 16, 7}, - {0, 18, 17}, - })); - - codecs.emplace(SpvOpSampledImage, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(67, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262285, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393297, 0, 0}, - {393298, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 10}, - {0, 30, 35}, - {0, 1, 36}, - {0, 11, 37}, - {0, 38, 6}, - {0, 16, 39}, - {0, 15, 40}, - {0, 25, 2}, - {0, 41, 20}, - {0, 26, 19}, - {0, 42, 29}, - {0, 28, 22}, - {0, 23, 34}, - {0, 44, 43}, - {0, 17, 45}, - {0, 24, 27}, - {0, 18, 33}, - {0, 47, 46}, - {0, 8, 48}, - {0, 50, 49}, - {0, 32, 51}, - {0, 31, 52}, - {0, 53, 21}, - {0, 54, 13}, - {0, 3, 55}, - {0, 7, 14}, - {0, 57, 56}, - {0, 58, 5}, - {0, 59, 9}, - {0, 61, 60}, - {0, 63, 62}, - {0, 64, 12}, - {0, 66, 65}, - })); - - codecs.emplace(SpvOpFMul, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(79, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262230, 0, 0}, - {262231, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {262328, 0, 0}, - {262334, 0, 0}, - {327692, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393297, 0, 0}, - {393303, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {458840, 0, 0}, - {524345, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 38, 33}, - {0, 18, 41}, - {0, 42, 23}, - {0, 43, 6}, - {0, 34, 44}, - {0, 1, 45}, - {0, 31, 14}, - {0, 47, 46}, - {0, 48, 2}, - {0, 12, 21}, - {0, 49, 30}, - {0, 37, 50}, - {0, 51, 20}, - {0, 5, 24}, - {0, 40, 16}, - {0, 29, 13}, - {0, 26, 52}, - {0, 53, 17}, - {0, 36, 54}, - {0, 55, 28}, - {0, 57, 56}, - {0, 19, 25}, - {0, 39, 8}, - {0, 32, 58}, - {0, 59, 27}, - {0, 22, 10}, - {0, 35, 60}, - {0, 62, 61}, - {0, 63, 7}, - {0, 65, 64}, - {0, 4, 66}, - {0, 68, 67}, - {0, 11, 3}, - {0, 15, 69}, - {0, 9, 70}, - {0, 72, 71}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - })); - - codecs.emplace(SpvOpFAdd, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(55, { - {0, 0, 0}, - {65556, 0, 0}, - {65562, 0, 0}, - {131073, 0, 0}, - {131094, 0, 0}, - {131105, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262177, 0, 0}, - {262188, 0, 0}, - {262198, 0, 0}, - {327713, 0, 0}, - {327724, 0, 0}, - {393249, 0, 0}, - {393260, 0, 0}, - {458785, 0, 0}, - {524313, 0, 0}, - {524321, 0, 0}, - {589857, 0, 0}, - {655393, 0, 0}, - {720929, 0, 0}, - {852001, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 26, 24}, - {0, 29, 27}, - {0, 4, 30}, - {0, 21, 9}, - {0, 31, 20}, - {0, 33, 32}, - {0, 34, 3}, - {0, 8, 35}, - {0, 36, 5}, - {0, 23, 16}, - {0, 38, 37}, - {0, 25, 2}, - {0, 39, 1}, - {0, 17, 40}, - {0, 41, 15}, - {0, 18, 42}, - {0, 43, 6}, - {0, 44, 14}, - {0, 28, 19}, - {0, 7, 45}, - {0, 46, 22}, - {0, 48, 47}, - {0, 49, 11}, - {0, 51, 50}, - {0, 12, 10}, - {0, 53, 52}, - {0, 13, 54}, - })); - - codecs.emplace(SpvOpTypePointer, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(57, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {262328, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 9, 23}, - {0, 1, 30}, - {0, 5, 31}, - {0, 32, 28}, - {0, 33, 25}, - {0, 34, 29}, - {0, 18, 24}, - {0, 27, 16}, - {0, 7, 13}, - {0, 14, 35}, - {0, 20, 10}, - {0, 36, 21}, - {0, 2, 37}, - {0, 38, 3}, - {0, 39, 22}, - {0, 40, 19}, - {0, 41, 11}, - {0, 6, 4}, - {0, 12, 42}, - {0, 43, 8}, - {0, 15, 26}, - {0, 45, 44}, - {0, 47, 46}, - {0, 48, 17}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 56, 55}, - })); - - codecs.emplace(SpvOpFSub, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {65785, 0, 0}, - {131134, 0, 0}, - {196719, 0, 0}, - {262209, 0, 0}, - {262276, 0, 0}, - {327745, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 4}, - {0, 2, 8}, - {0, 1, 9}, - {0, 5, 10}, - {0, 3, 6}, - {0, 12, 11}, - })); - - codecs.emplace(SpvOpIAdd, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(83, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196669, 0, 0}, - {196732, 0, 0}, - {196735, 0, 0}, - {262209, 0, 0}, - {262221, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262230, 0, 0}, - {262231, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {262328, 0, 0}, - {262334, 0, 0}, - {262340, 0, 0}, - {327692, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393297, 0, 0}, - {393298, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {458840, 0, 0}, - {458842, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 25, 2}, - {0, 31, 43}, - {0, 4, 44}, - {0, 26, 45}, - {0, 39, 46}, - {0, 34, 36}, - {0, 19, 47}, - {0, 6, 48}, - {0, 35, 9}, - {0, 12, 29}, - {0, 21, 49}, - {0, 22, 13}, - {0, 17, 50}, - {0, 23, 51}, - {0, 52, 7}, - {0, 37, 1}, - {0, 53, 3}, - {0, 54, 24}, - {0, 56, 55}, - {0, 32, 57}, - {0, 59, 58}, - {0, 42, 10}, - {0, 60, 8}, - {0, 5, 41}, - {0, 61, 20}, - {0, 62, 38}, - {0, 64, 63}, - {0, 40, 65}, - {0, 66, 18}, - {0, 15, 28}, - {0, 14, 67}, - {0, 68, 30}, - {0, 70, 69}, - {0, 72, 71}, - {0, 73, 27}, - {0, 16, 74}, - {0, 75, 33}, - {0, 77, 76}, - {0, 79, 78}, - {0, 81, 80}, - {0, 82, 11}, - })); - - codecs.emplace(SpvOpCompositeExtract, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(29, { - {0, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {262209, 0, 0}, - {262225, 0, 0}, - {262273, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393295, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 10, 6}, - {0, 16, 13}, - {0, 7, 17}, - {0, 15, 18}, - {0, 19, 12}, - {0, 20, 14}, - {0, 1, 4}, - {0, 22, 21}, - {0, 11, 8}, - {0, 2, 5}, - {0, 9, 23}, - {0, 3, 24}, - {0, 26, 25}, - {0, 28, 27}, - })); - - codecs.emplace(SpvOpVectorTimesMatrix, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {65784, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(SpvOpBranch, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {262198, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(SpvOpFunctionEnd, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {65784, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(SpvOpBranchConditional, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(53, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196665, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {393228, 0, 0}, - {393295, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 25, 16}, - {0, 21, 28}, - {0, 18, 23}, - {0, 4, 29}, - {0, 10, 5}, - {0, 1, 30}, - {0, 32, 31}, - {0, 22, 33}, - {0, 34, 8}, - {0, 35, 15}, - {0, 13, 36}, - {0, 26, 17}, - {0, 38, 37}, - {0, 39, 11}, - {0, 40, 14}, - {0, 12, 27}, - {0, 19, 41}, - {0, 24, 42}, - {0, 44, 43}, - {0, 45, 7}, - {0, 20, 46}, - {0, 9, 47}, - {0, 48, 2}, - {0, 50, 49}, - {0, 6, 3}, - {0, 52, 51}, - })); - - codecs.emplace(SpvOpFunctionCall, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(71, { - {0, 0, 0}, - {65556, 0, 0}, - {65562, 0, 0}, - {131073, 0, 0}, - {131094, 0, 0}, - {131099, 0, 0}, - {131134, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196651, 0, 0}, - {196665, 0, 0}, - {196667, 0, 0}, - {196669, 0, 0}, - {262188, 0, 0}, - {262198, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262225, 0, 0}, - {262275, 0, 0}, - {262280, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327724, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {393228, 0, 0}, - {393260, 0, 0}, - {393273, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {458831, 0, 0}, - {524313, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 22, 4}, - {0, 32, 23}, - {0, 37, 30}, - {0, 21, 38}, - {0, 39, 31}, - {0, 41, 40}, - {0, 13, 42}, - {0, 43, 26}, - {0, 10, 44}, - {0, 28, 45}, - {0, 35, 18}, - {0, 20, 46}, - {0, 33, 47}, - {0, 24, 48}, - {0, 6, 49}, - {0, 3, 50}, - {0, 16, 51}, - {0, 27, 52}, - {0, 53, 1}, - {0, 9, 17}, - {0, 29, 54}, - {0, 19, 2}, - {0, 8, 36}, - {0, 55, 34}, - {0, 25, 56}, - {0, 7, 57}, - {0, 5, 58}, - {0, 60, 59}, - {0, 61, 15}, - {0, 63, 62}, - {0, 65, 64}, - {0, 66, 11}, - {0, 12, 67}, - {0, 69, 68}, - {0, 14, 70}, - })); - - codecs.emplace(SpvOpVariable, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(SpvOpAccessChain, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(73, { - {0, 0, 0}, - {252, 0, 0}, - {253, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131073, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196665, 0, 0}, - {196667, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {196854, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262221, 0, 0}, - {262225, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262276, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {262321, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393298, 0, 0}, - {393461, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 28, 5}, - {0, 30, 8}, - {0, 13, 38}, - {0, 40, 39}, - {0, 41, 26}, - {0, 42, 19}, - {0, 43, 29}, - {0, 23, 44}, - {0, 36, 32}, - {0, 45, 22}, - {0, 2, 46}, - {0, 21, 20}, - {0, 48, 47}, - {0, 33, 49}, - {0, 4, 50}, - {0, 51, 24}, - {0, 18, 11}, - {0, 52, 12}, - {0, 25, 15}, - {0, 53, 17}, - {0, 37, 54}, - {0, 55, 35}, - {0, 7, 27}, - {0, 57, 56}, - {0, 58, 31}, - {0, 6, 59}, - {0, 1, 60}, - {0, 62, 61}, - {0, 63, 14}, - {0, 3, 16}, - {0, 34, 64}, - {0, 66, 65}, - {0, 68, 67}, - {0, 70, 69}, - {0, 10, 9}, - {0, 72, 71}, - })); - - codecs.emplace(SpvOpLabel, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {56, 0, 0}, - {65784, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 1, 4}, - })); - - codecs.emplace(SpvOpReturn, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {65784, 0, 0}, - {131127, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(SpvOpFunction, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(31, { - {0, 0, 0}, - {65556, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262177, 0, 0}, - {262188, 0, 0}, - {262198, 0, 0}, - {327713, 0, 0}, - {393260, 0, 0}, - {524313, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 12, 1}, - {0, 13, 5}, - {0, 18, 17}, - {0, 7, 19}, - {0, 9, 20}, - {0, 16, 21}, - {0, 15, 10}, - {0, 22, 4}, - {0, 24, 23}, - {0, 25, 14}, - {0, 8, 11}, - {0, 2, 26}, - {0, 28, 27}, - {0, 3, 6}, - {0, 30, 29}, - })); - - codecs.emplace(SpvOpTypeVector, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {65784, 0, 0}, - {131127, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 4, 1}, - })); - - codecs.emplace(SpvOpFunctionParameter, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {56, 0, 0}, - {65784, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 1, 4}, - })); - - codecs.emplace(SpvOpReturnValue, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {131105, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(SpvOpTypeVoid, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(89, { - {0, 0, 0}, - {253, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196665, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {458764, 0, 0}, - {458809, 0, 0}, - {458831, 0, 0}, - {524345, 0, 0}, - {524367, 0, 0}, - {589881, 0, 0}, - {655417, 0, 0}, - {720953, 0, 0}, - {786489, 0, 0}, - {852025, 0, 0}, - {917561, 0, 0}, - {983097, 0, 0}, - {1114169, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 40, 32}, - {0, 46, 29}, - {0, 38, 27}, - {0, 20, 47}, - {0, 49, 48}, - {0, 50, 44}, - {0, 51, 43}, - {0, 14, 5}, - {0, 42, 52}, - {0, 13, 19}, - {0, 3, 26}, - {0, 54, 53}, - {0, 56, 55}, - {0, 57, 6}, - {0, 39, 37}, - {0, 15, 58}, - {0, 18, 31}, - {0, 59, 21}, - {0, 60, 17}, - {0, 61, 41}, - {0, 62, 24}, - {0, 34, 63}, - {0, 35, 64}, - {0, 65, 8}, - {0, 66, 36}, - {0, 67, 30}, - {0, 16, 11}, - {0, 69, 68}, - {0, 70, 28}, - {0, 22, 71}, - {0, 33, 72}, - {0, 45, 73}, - {0, 75, 74}, - {0, 77, 76}, - {0, 78, 12}, - {0, 1, 2}, - {0, 9, 79}, - {0, 25, 80}, - {0, 23, 81}, - {0, 4, 82}, - {0, 84, 83}, - {0, 86, 85}, - {0, 7, 10}, - {0, 88, 87}, - })); - - codecs.emplace(SpvOpStore, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {131075, 0, 0}, - {131088, 0, 0}, - {131143, 0, 0}, - {196624, 0, 0}, - {196679, 0, 0}, - {262216, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 8}, - {0, 7, 9}, - {0, 6, 10}, - {0, 5, 11}, - {0, 2, 12}, - })); - - codecs.emplace(SpvOpEntryPoint, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(97, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196665, 0, 0}, - {196669, 0, 0}, - {196732, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262230, 0, 0}, - {262231, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262276, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {262326, 0, 0}, - {262328, 0, 0}, - {262330, 0, 0}, - {327692, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393297, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458809, 0, 0}, - {458817, 0, 0}, - {458831, 0, 0}, - {458840, 0, 0}, - {524345, 0, 0}, - {524367, 0, 0}, - {589881, 0, 0}, - {720953, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 42, 47}, - {0, 48, 50}, - {0, 45, 51}, - {0, 34, 52}, - {0, 53, 41}, - {0, 1, 54}, - {0, 55, 5}, - {0, 15, 4}, - {0, 56, 35}, - {0, 26, 24}, - {0, 18, 28}, - {0, 57, 38}, - {0, 59, 58}, - {0, 60, 25}, - {0, 20, 9}, - {0, 7, 61}, - {0, 62, 22}, - {0, 11, 31}, - {0, 63, 8}, - {0, 64, 40}, - {0, 66, 65}, - {0, 27, 44}, - {0, 29, 67}, - {0, 68, 39}, - {0, 69, 2}, - {0, 37, 49}, - {0, 71, 70}, - {0, 30, 72}, - {0, 73, 17}, - {0, 33, 74}, - {0, 23, 14}, - {0, 32, 75}, - {0, 21, 76}, - {0, 77, 16}, - {0, 46, 78}, - {0, 13, 79}, - {0, 80, 12}, - {0, 19, 81}, - {0, 43, 36}, - {0, 83, 82}, - {0, 10, 84}, - {0, 85, 3}, - {0, 6, 86}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - {0, 96, 95}, - })); - - codecs.emplace(SpvOpLoad, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(47, { - {0, 0, 0}, - {262159, 0, 0}, - {327695, 0, 0}, - {393231, 0, 0}, - {458767, 0, 0}, - {524303, 0, 0}, - {589839, 0, 0}, - {655375, 0, 0}, - {720911, 0, 0}, - {786447, 0, 0}, - {851983, 0, 0}, - {917519, 0, 0}, - {983055, 0, 0}, - {1048591, 0, 0}, - {1114127, 0, 0}, - {1179663, 0, 0}, - {1245199, 0, 0}, - {1310735, 0, 0}, - {1376271, 0, 0}, - {1441807, 0, 0}, - {1507343, 0, 0}, - {1572879, 0, 0}, - {1638415, 0, 0}, - {1703951, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 23}, - {0, 22, 25}, - {0, 21, 26}, - {0, 6, 20}, - {0, 19, 27}, - {0, 29, 28}, - {0, 24, 18}, - {0, 30, 13}, - {0, 31, 14}, - {0, 32, 7}, - {0, 17, 15}, - {0, 33, 2}, - {0, 34, 8}, - {0, 16, 12}, - {0, 35, 3}, - {0, 36, 5}, - {0, 9, 37}, - {0, 39, 38}, - {0, 11, 40}, - {0, 4, 10}, - {0, 42, 41}, - {0, 44, 43}, - {0, 46, 45}, - })); - - codecs.emplace(SpvOpMemoryModel, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {196631, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 4, 5}, - {0, 1, 6}, - })); - - codecs.emplace(SpvOpTypeFloat, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(69, { - {0, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262289, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {327849, 0, 0}, - {393228, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458809, 0, 0}, - {458831, 0, 0}, - {524345, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 33, 10}, - {0, 31, 36}, - {0, 26, 37}, - {0, 5, 38}, - {0, 20, 39}, - {0, 22, 40}, - {0, 24, 25}, - {0, 15, 41}, - {0, 9, 17}, - {0, 1, 42}, - {0, 4, 43}, - {0, 35, 44}, - {0, 34, 45}, - {0, 19, 46}, - {0, 7, 29}, - {0, 16, 47}, - {0, 48, 32}, - {0, 49, 27}, - {0, 11, 14}, - {0, 18, 28}, - {0, 23, 50}, - {0, 51, 12}, - {0, 52, 21}, - {0, 6, 53}, - {0, 55, 54}, - {0, 57, 56}, - {0, 3, 58}, - {0, 13, 59}, - {0, 60, 8}, - {0, 30, 61}, - {0, 62, 2}, - {0, 64, 63}, - {0, 66, 65}, - {0, 68, 67}, - })); - - codecs.emplace(SpvOpCompositeConstruct, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(39, { - {0, 0, 0}, - {65556, 0, 0}, - {131094, 0, 0}, - {131105, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {262177, 0, 0}, - {327713, 0, 0}, - {393249, 0, 0}, - {458785, 0, 0}, - {524313, 0, 0}, - {524321, 0, 0}, - {589857, 0, 0}, - {655393, 0, 0}, - {786465, 0, 0}, - {917537, 0, 0}, - {1048609, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 19, 18}, - {0, 21, 15}, - {0, 1, 22}, - {0, 16, 23}, - {0, 14, 24}, - {0, 20, 25}, - {0, 13, 17}, - {0, 3, 26}, - {0, 6, 11}, - {0, 27, 12}, - {0, 4, 28}, - {0, 29, 10}, - {0, 9, 30}, - {0, 7, 31}, - {0, 33, 32}, - {0, 34, 5}, - {0, 8, 35}, - {0, 2, 36}, - {0, 38, 37}, - })); - - codecs.emplace(SpvOpTypeFunction, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {131086, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(SpvOpExtInstImport, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {131099, 0, 0}, - {196640, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(SpvOpTypeImage, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {131143, 0, 0}, - {196679, 0, 0}, - {196680, 0, 0}, - {262216, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 2}, - {0, 3, 6}, - {0, 7, 1}, - {0, 4, 8}, - })); - - codecs.emplace(SpvOpMemberDecorate, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {65553, 0, 0}, - {131083, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(SpvOpCapability, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(17, { - {0, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196640, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {327713, 0, 0}, - {458785, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 8}, - {0, 1, 10}, - {0, 6, 11}, - {0, 9, 12}, - {0, 4, 13}, - {0, 3, 14}, - {0, 15, 2}, - {0, 5, 16}, - })); - - codecs.emplace(SpvOpTypeInt, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(29, { - {0, 0, 0}, - {65556, 0, 0}, - {131073, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262188, 0, 0}, - {262198, 0, 0}, - {327724, 0, 0}, - {393260, 0, 0}, - {524313, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 6}, - {0, 16, 3}, - {0, 11, 17}, - {0, 5, 18}, - {0, 15, 19}, - {0, 13, 20}, - {0, 1, 4}, - {0, 12, 21}, - {0, 7, 22}, - {0, 14, 23}, - {0, 24, 10}, - {0, 25, 9}, - {0, 27, 26}, - {0, 8, 28}, - })); - - codecs.emplace(SpvOpConstantComposite, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {65556, 0, 0}, - {196631, 0, 0}, - {196640, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {327724, 0, 0}, - {393260, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 7}, - {0, 1, 9}, - {0, 10, 8}, - {0, 2, 11}, - {0, 5, 12}, - {0, 13, 4}, - {0, 3, 14}, - })); - - codecs.emplace(SpvOpTypeSampledImage, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(21, { - {0, 0, 0}, - {131073, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262198, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 11, 12}, - {0, 8, 13}, - {0, 7, 14}, - {0, 4, 10}, - {0, 9, 2}, - {0, 16, 15}, - {0, 1, 17}, - {0, 19, 18}, - {0, 6, 20}, - })); - - codecs.emplace(SpvOpTypeStruct, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(49, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 20, 12}, - {0, 26, 24}, - {0, 21, 27}, - {0, 28, 16}, - {0, 10, 8}, - {0, 30, 29}, - {0, 31, 17}, - {0, 32, 13}, - {0, 25, 6}, - {0, 1, 33}, - {0, 14, 11}, - {0, 3, 34}, - {0, 18, 35}, - {0, 37, 36}, - {0, 23, 5}, - {0, 38, 2}, - {0, 39, 7}, - {0, 4, 9}, - {0, 40, 19}, - {0, 42, 41}, - {0, 43, 22}, - {0, 45, 44}, - {0, 46, 15}, - {0, 48, 47}, - })); - - codecs.emplace(SpvOpFNegate, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {65555, 0, 0}, - {131143, 0, 0}, - {196679, 0, 0}, - {196680, 0, 0}, - {262216, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 6}, - {0, 1, 2}, - {0, 8, 7}, - {0, 5, 9}, - {0, 3, 10}, - })); - - codecs.emplace(SpvOpDecorate, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(25, { - {0, 0, 0}, - {65562, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262177, 0, 0}, - {262198, 0, 0}, - {327713, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 12, 11}, - {0, 9, 14}, - {0, 10, 15}, - {0, 13, 16}, - {0, 4, 17}, - {0, 2, 1}, - {0, 18, 7}, - {0, 20, 19}, - {0, 21, 3}, - {0, 22, 6}, - {0, 5, 8}, - {0, 24, 23}, - })); - - codecs.emplace(SpvOpTypeMatrix, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(31, { - {0, 0, 0}, - {65556, 0, 0}, - {131073, 0, 0}, - {131094, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262188, 0, 0}, - {262198, 0, 0}, - {327724, 0, 0}, - {393260, 0, 0}, - {524313, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 12, 2}, - {0, 17, 3}, - {0, 5, 18}, - {0, 1, 19}, - {0, 16, 4}, - {0, 21, 20}, - {0, 6, 15}, - {0, 7, 22}, - {0, 24, 23}, - {0, 13, 14}, - {0, 25, 8}, - {0, 26, 11}, - {0, 27, 10}, - {0, 29, 28}, - {0, 30, 9}, - })); - - codecs.emplace(SpvOpConstant, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(33, { - {0, 0, 0}, - {131113, 0, 0}, - {196629, 0, 0}, - {196631, 0, 0}, - {196632, 0, 0}, - {196640, 0, 0}, - {196641, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {262188, 0, 0}, - {262198, 0, 0}, - {327713, 0, 0}, - {327724, 0, 0}, - {393249, 0, 0}, - {393260, 0, 0}, - {524313, 0, 0}, - {524321, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 4}, - {0, 13, 11}, - {0, 16, 15}, - {0, 18, 10}, - {0, 20, 19}, - {0, 21, 2}, - {0, 23, 22}, - {0, 8, 24}, - {0, 9, 25}, - {0, 17, 26}, - {0, 14, 27}, - {0, 12, 28}, - {0, 1, 3}, - {0, 5, 29}, - {0, 30, 7}, - {0, 32, 31}, - })); - - codecs.emplace(SpvOpTypeBool, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {196636, 0, 0}, - {196640, 0, 0}, - {196651, 0, 0}, - {196667, 0, 0}, - {524313, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 5}, - {0, 3, 7}, - {0, 2, 8}, - {0, 6, 9}, - {0, 1, 10}, - })); - - codecs.emplace(SpvOpTypeArray, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(67, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {262334, 0, 0}, - {327692, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 27}, - {0, 11, 28}, - {0, 35, 21}, - {0, 36, 1}, - {0, 4, 37}, - {0, 39, 38}, - {0, 40, 30}, - {0, 41, 12}, - {0, 19, 42}, - {0, 13, 43}, - {0, 16, 44}, - {0, 45, 22}, - {0, 34, 18}, - {0, 29, 24}, - {0, 46, 25}, - {0, 6, 2}, - {0, 9, 31}, - {0, 17, 47}, - {0, 49, 48}, - {0, 50, 33}, - {0, 51, 26}, - {0, 20, 52}, - {0, 32, 53}, - {0, 3, 54}, - {0, 15, 14}, - {0, 23, 55}, - {0, 8, 56}, - {0, 58, 57}, - {0, 10, 59}, - {0, 5, 60}, - {0, 62, 61}, - {0, 64, 63}, - {0, 66, 65}, - })); - - codecs.emplace(SpvOpExtInst, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(57, { - {0, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196665, 0, 0}, - {196669, 0, 0}, - {196718, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393303, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 18, 6}, - {0, 30, 22}, - {0, 31, 25}, - {0, 10, 32}, - {0, 21, 33}, - {0, 3, 34}, - {0, 35, 5}, - {0, 23, 36}, - {0, 14, 17}, - {0, 37, 26}, - {0, 1, 38}, - {0, 29, 39}, - {0, 13, 40}, - {0, 41, 19}, - {0, 28, 20}, - {0, 16, 42}, - {0, 27, 43}, - {0, 8, 24}, - {0, 7, 44}, - {0, 9, 45}, - {0, 15, 46}, - {0, 12, 47}, - {0, 48, 2}, - {0, 4, 49}, - {0, 51, 50}, - {0, 11, 52}, - {0, 54, 53}, - {0, 56, 55}, - })); - - codecs.emplace(SpvOpVectorTimesScalar, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(67, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262230, 0, 0}, - {262231, 0, 0}, - {262272, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327737, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393273, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393303, 0, 0}, - {393304, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 26, 29}, - {0, 20, 35}, - {0, 12, 36}, - {0, 6, 37}, - {0, 38, 28}, - {0, 30, 5}, - {0, 8, 39}, - {0, 2, 40}, - {0, 41, 21}, - {0, 1, 10}, - {0, 43, 42}, - {0, 23, 16}, - {0, 44, 33}, - {0, 34, 31}, - {0, 14, 45}, - {0, 19, 46}, - {0, 25, 47}, - {0, 49, 48}, - {0, 27, 22}, - {0, 7, 50}, - {0, 17, 32}, - {0, 18, 51}, - {0, 24, 52}, - {0, 54, 53}, - {0, 55, 9}, - {0, 56, 11}, - {0, 57, 4}, - {0, 15, 58}, - {0, 59, 13}, - {0, 60, 3}, - {0, 62, 61}, - {0, 64, 63}, - {0, 66, 65}, - })); - - codecs.emplace(SpvOpVectorShuffle, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(33, { - {0, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {262201, 0, 0}, - {262209, 0, 0}, - {262225, 0, 0}, - {262231, 0, 0}, - {262273, 0, 0}, - {262277, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {327745, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {458831, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 13, 12}, - {0, 1, 18}, - {0, 19, 11}, - {0, 9, 20}, - {0, 10, 21}, - {0, 22, 15}, - {0, 23, 8}, - {0, 4, 24}, - {0, 25, 7}, - {0, 17, 26}, - {0, 5, 27}, - {0, 14, 3}, - {0, 29, 28}, - {0, 30, 2}, - {0, 6, 31}, - {0, 32, 16}, - })); - - codecs.emplace(SpvOpImageSampleImplicitLod, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(55, { - {0, 0, 0}, - {65785, 0, 0}, - {65790, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {196817, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262292, 0, 0}, - {327692, 0, 0}, - {327745, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393281, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393298, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 2}, - {0, 22, 29}, - {0, 30, 1}, - {0, 6, 31}, - {0, 9, 32}, - {0, 28, 3}, - {0, 27, 33}, - {0, 20, 16}, - {0, 34, 8}, - {0, 10, 35}, - {0, 4, 36}, - {0, 24, 23}, - {0, 21, 13}, - {0, 7, 37}, - {0, 38, 14}, - {0, 25, 39}, - {0, 17, 11}, - {0, 12, 19}, - {0, 41, 40}, - {0, 42, 18}, - {0, 15, 43}, - {0, 45, 44}, - {0, 47, 46}, - {0, 26, 48}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - })); - - codecs.emplace(SpvOpDot, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {131075, 0, 0}, - {131088, 0, 0}, - {196624, 0, 0}, - {196679, 0, 0}, - {262216, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 3}, - {0, 2, 7}, - {0, 1, 8}, - {0, 6, 9}, - {0, 4, 10}, - })); - - codecs.emplace(SpvOpExecutionMode, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {196858, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(SpvOpSelectionMerge, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(23, { - {0, 0, 0}, - {131134, 0, 0}, - {196669, 0, 0}, - {262209, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262277, 0, 0}, - {327745, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 12}, - {0, 7, 13}, - {0, 5, 1}, - {0, 4, 10}, - {0, 14, 6}, - {0, 16, 15}, - {0, 17, 11}, - {0, 3, 8}, - {0, 19, 18}, - {0, 9, 20}, - {0, 22, 21}, - })); - - codecs.emplace(SpvOpImageSampleDrefExplicitLod, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {65790, 0, 0}, - {131073, 0, 0}, - {262198, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 1}, - {0, 3, 5}, - {0, 2, 6}, - })); - - codecs.emplace(SpvOpUndef, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(59, { - {0, 0, 0}, - {65785, 0, 0}, - {131134, 0, 0}, - {131319, 0, 0}, - {196669, 0, 0}, - {196735, 0, 0}, - {262209, 0, 0}, - {262221, 0, 0}, - {262224, 0, 0}, - {262225, 0, 0}, - {262230, 0, 0}, - {262273, 0, 0}, - {262275, 0, 0}, - {262277, 0, 0}, - {262280, 0, 0}, - {262286, 0, 0}, - {262288, 0, 0}, - {262292, 0, 0}, - {262334, 0, 0}, - {327692, 0, 0}, - {327760, 0, 0}, - {327761, 0, 0}, - {327762, 0, 0}, - {393228, 0, 0}, - {393295, 0, 0}, - {393296, 0, 0}, - {393298, 0, 0}, - {458764, 0, 0}, - {458831, 0, 0}, - {524367, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 17, 3}, - {0, 5, 31}, - {0, 11, 32}, - {0, 33, 12}, - {0, 34, 20}, - {0, 16, 27}, - {0, 35, 23}, - {0, 37, 36}, - {0, 14, 18}, - {0, 39, 38}, - {0, 7, 30}, - {0, 8, 25}, - {0, 40, 15}, - {0, 13, 2}, - {0, 1, 29}, - {0, 19, 41}, - {0, 43, 42}, - {0, 28, 44}, - {0, 46, 45}, - {0, 22, 21}, - {0, 47, 24}, - {0, 48, 26}, - {0, 10, 6}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 4, 9}, - {0, 56, 55}, - {0, 58, 57}, - })); - - codecs.emplace(SpvOpCompositeInsert, std::move(codec)); - } - - return codecs; -} - -std::map>> -GetLiteralStringHuffmanCodecs() { - std::map>> codecs; - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {"", 0, 0}, - {"MainPs", 0, 0}, - {"MainVs", 0, 0}, - {"kMarkvNoneOfTheAbove", 0, 0}, - {"main", 0, 0}, - {"", 2, 3}, - {"", 1, 5}, - {"", 4, 6}, - })); - - codecs.emplace(SpvOpEntryPoint, std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {"", 0, 0}, - {"GLSL.std.450", 0, 0}, - {"kMarkvNoneOfTheAbove", 0, 0}, - {"", 1, 2}, - })); - - codecs.emplace(SpvOpExtInstImport, std::move(codec)); - } - - return codecs; -} - -std::map, std::unique_ptr>> -GetNonIdWordHuffmanCodecs() { - std::map, std::unique_ptr>> codecs; - { - std::unique_ptr> codec(new HuffmanCodec(33, { - {0, 0, 0}, - {4, 0, 0}, - {8, 0, 0}, - {10, 0, 0}, - {26, 0, 0}, - {29, 0, 0}, - {31, 0, 0}, - {37, 0, 0}, - {40, 0, 0}, - {43, 0, 0}, - {46, 0, 0}, - {49, 0, 0}, - {66, 0, 0}, - {67, 0, 0}, - {68, 0, 0}, - {69, 0, 0}, - {71, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 12, 5}, - {0, 18, 13}, - {0, 3, 7}, - {0, 19, 11}, - {0, 20, 16}, - {0, 14, 17}, - {0, 21, 1}, - {0, 2, 6}, - {0, 23, 22}, - {0, 4, 24}, - {0, 26, 25}, - {0, 28, 27}, - {0, 10, 15}, - {0, 8, 9}, - {0, 30, 29}, - {0, 32, 31}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {0, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpMemoryModel, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpMemoryModel, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {0, 0, 0}, - {4, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(std::pair(SpvOpEntryPoint, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpExecutionMode, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {18, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 2}, - {0, 6, 5}, - {0, 7, 1}, - {0, 3, 8}, - {0, 10, 9}, - })); - - codecs.emplace(std::pair(SpvOpExecutionMode, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1, 0, 0}, - {32, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpCapability, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {32, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeInt, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeInt, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {32, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeFloat, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 4}, - {0, 1, 5}, - {0, 6, 3}, - })); - - codecs.emplace(std::pair(SpvOpTypeVector, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 2, 5}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeMatrix, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 2, 5}, - {0, 1, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeImage, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeImage, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {0, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeImage, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {0, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeImage, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeImage, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {0, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeImage, 7), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 7}, - {0, 6, 8}, - {0, 1, 4}, - {0, 2, 9}, - {0, 10, 3}, - {0, 12, 11}, - })); - - codecs.emplace(std::pair(SpvOpTypePointer, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(173, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {11, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {14, 0, 0}, - {15, 0, 0}, - {16, 0, 0}, - {17, 0, 0}, - {18, 0, 0}, - {19, 0, 0}, - {20, 0, 0}, - {21, 0, 0}, - {22, 0, 0}, - {23, 0, 0}, - {24, 0, 0}, - {26, 0, 0}, - {27, 0, 0}, - {28, 0, 0}, - {29, 0, 0}, - {30, 0, 0}, - {31, 0, 0}, - {32, 0, 0}, - {256, 0, 0}, - {507307272, 0, 0}, - {864026611, 0, 0}, - {981668463, 0, 0}, - {997553156, 0, 0}, - {1014330372, 0, 0}, - {1020708227, 0, 0}, - {1028443341, 0, 0}, - {1032953056, 0, 0}, - {1033463938, 0, 0}, - {1033463943, 0, 0}, - {1039998884, 0, 0}, - {1039998950, 0, 0}, - {1040187392, 0, 0}, - {1042401985, 0, 0}, - {1044220635, 0, 0}, - {1045622707, 0, 0}, - {1045622740, 0, 0}, - {1048576000, 0, 0}, - {1053609165, 0, 0}, - {1053790359, 0, 0}, - {1054448026, 0, 0}, - {1055437881, 0, 0}, - {1056300230, 0, 0}, - {1056964608, 0, 0}, - {1058056805, 0, 0}, - {1059286575, 0, 0}, - {1061158912, 0, 0}, - {1061997773, 0, 0}, - {1064514355, 0, 0}, - {1064854933, 0, 0}, - {1065353216, 0, 0}, - {1069547520, 0, 0}, - {1073741824, 0, 0}, - {1077936128, 0, 0}, - {1082130432, 0, 0}, - {1091567616, 0, 0}, - {1115422720, 0, 0}, - {1124073472, 0, 0}, - {1132396544, 0, 0}, - {1140850688, 0, 0}, - {1199562752, 0, 0}, - {3179067684, 0, 0}, - {3180973575, 0, 0}, - {3182651297, 0, 0}, - {3196448879, 0, 0}, - {3204448256, 0, 0}, - {3204993516, 0, 0}, - {3205248529, 0, 0}, - {3207137644, 0, 0}, - {3208642560, 0, 0}, - {3211081967, 0, 0}, - {3212836864, 0, 0}, - {3332128768, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 38, 37}, - {0, 42, 39}, - {0, 49, 44}, - {0, 45, 43}, - {0, 26, 50}, - {0, 46, 73}, - {0, 35, 28}, - {0, 32, 65}, - {0, 83, 40}, - {0, 60, 62}, - {0, 27, 54}, - {0, 79, 67}, - {0, 31, 74}, - {0, 51, 12}, - {0, 70, 30}, - {0, 15, 16}, - {0, 88, 25}, - {0, 90, 89}, - {0, 34, 71}, - {0, 72, 29}, - {0, 92, 91}, - {0, 14, 33}, - {0, 94, 93}, - {0, 22, 23}, - {0, 21, 95}, - {0, 19, 24}, - {0, 96, 13}, - {0, 47, 41}, - {0, 53, 48}, - {0, 58, 56}, - {0, 63, 59}, - {0, 76, 75}, - {0, 78, 77}, - {0, 81, 80}, - {0, 84, 82}, - {0, 52, 20}, - {0, 97, 69}, - {0, 99, 98}, - {0, 18, 10}, - {0, 68, 61}, - {0, 17, 100}, - {0, 102, 101}, - {0, 11, 36}, - {0, 104, 103}, - {0, 86, 105}, - {0, 107, 106}, - {0, 109, 108}, - {0, 110, 9}, - {0, 8, 111}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 126, 7}, - {0, 127, 85}, - {0, 6, 128}, - {0, 129, 55}, - {0, 130, 5}, - {0, 132, 131}, - {0, 134, 133}, - {0, 136, 135}, - {0, 137, 66}, - {0, 139, 138}, - {0, 141, 140}, - {0, 143, 142}, - {0, 145, 144}, - {0, 146, 57}, - {0, 147, 64}, - {0, 148, 4}, - {0, 149, 2}, - {0, 151, 150}, - {0, 152, 3}, - {0, 154, 153}, - {0, 156, 155}, - {0, 158, 157}, - {0, 159, 1}, - {0, 160, 87}, - {0, 162, 161}, - {0, 164, 163}, - {0, 166, 165}, - {0, 168, 167}, - {0, 170, 169}, - {0, 172, 171}, - })); - - codecs.emplace(std::pair(SpvOpConstant, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {0, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpFunction, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 7}, - {0, 4, 8}, - {0, 9, 2}, - {0, 1, 5}, - {0, 10, 6}, - {0, 12, 11}, - })); - - codecs.emplace(std::pair(SpvOpVariable, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {0, 0, 0}, - {2, 0, 0}, - {6, 0, 0}, - {11, 0, 0}, - {30, 0, 0}, - {33, 0, 0}, - {34, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 8}, - {0, 9, 1}, - {0, 3, 10}, - {0, 6, 11}, - {0, 12, 2}, - {0, 7, 5}, - {0, 14, 13}, - })); - - codecs.emplace(std::pair(SpvOpDecorate, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(37, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {14, 0, 0}, - {15, 0, 0}, - {16, 0, 0}, - {18, 0, 0}, - {64, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 17, 11}, - {0, 10, 13}, - {0, 12, 14}, - {0, 21, 20}, - {0, 9, 22}, - {0, 19, 15}, - {0, 8, 23}, - {0, 18, 24}, - {0, 25, 7}, - {0, 5, 6}, - {0, 26, 16}, - {0, 27, 4}, - {0, 28, 3}, - {0, 30, 29}, - {0, 31, 2}, - {0, 33, 32}, - {0, 35, 34}, - {0, 1, 36}, - })); - - codecs.emplace(std::pair(SpvOpDecorate, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(79, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {11, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {14, 0, 0}, - {15, 0, 0}, - {16, 0, 0}, - {17, 0, 0}, - {18, 0, 0}, - {19, 0, 0}, - {20, 0, 0}, - {21, 0, 0}, - {22, 0, 0}, - {23, 0, 0}, - {24, 0, 0}, - {25, 0, 0}, - {26, 0, 0}, - {27, 0, 0}, - {28, 0, 0}, - {29, 0, 0}, - {30, 0, 0}, - {31, 0, 0}, - {32, 0, 0}, - {33, 0, 0}, - {34, 0, 0}, - {35, 0, 0}, - {36, 0, 0}, - {37, 0, 0}, - {38, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 39, 37}, - {0, 40, 36}, - {0, 34, 35}, - {0, 32, 33}, - {0, 30, 31}, - {0, 27, 29}, - {0, 26, 28}, - {0, 42, 41}, - {0, 23, 25}, - {0, 38, 22}, - {0, 44, 43}, - {0, 46, 45}, - {0, 21, 47}, - {0, 19, 20}, - {0, 17, 18}, - {0, 14, 15}, - {0, 12, 10}, - {0, 16, 13}, - {0, 9, 11}, - {0, 7, 8}, - {0, 6, 5}, - {0, 24, 48}, - {0, 50, 49}, - {0, 3, 4}, - {0, 51, 2}, - {0, 1, 52}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 60, 59}, - {0, 62, 61}, - {0, 64, 63}, - {0, 66, 65}, - {0, 68, 67}, - {0, 70, 69}, - {0, 72, 71}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - })); - - codecs.emplace(std::pair(SpvOpMemberDecorate, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {4, 0, 0}, - {7, 0, 0}, - {35, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 5, 2}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpMemberDecorate, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(149, { - {0, 0, 0}, - {0, 0, 0}, - {16, 0, 0}, - {28, 0, 0}, - {32, 0, 0}, - {36, 0, 0}, - {40, 0, 0}, - {44, 0, 0}, - {48, 0, 0}, - {60, 0, 0}, - {64, 0, 0}, - {76, 0, 0}, - {80, 0, 0}, - {84, 0, 0}, - {88, 0, 0}, - {92, 0, 0}, - {96, 0, 0}, - {100, 0, 0}, - {108, 0, 0}, - {112, 0, 0}, - {120, 0, 0}, - {124, 0, 0}, - {128, 0, 0}, - {132, 0, 0}, - {136, 0, 0}, - {140, 0, 0}, - {144, 0, 0}, - {148, 0, 0}, - {152, 0, 0}, - {156, 0, 0}, - {160, 0, 0}, - {172, 0, 0}, - {176, 0, 0}, - {192, 0, 0}, - {204, 0, 0}, - {208, 0, 0}, - {224, 0, 0}, - {236, 0, 0}, - {240, 0, 0}, - {248, 0, 0}, - {256, 0, 0}, - {272, 0, 0}, - {288, 0, 0}, - {292, 0, 0}, - {296, 0, 0}, - {300, 0, 0}, - {304, 0, 0}, - {316, 0, 0}, - {320, 0, 0}, - {332, 0, 0}, - {336, 0, 0}, - {348, 0, 0}, - {352, 0, 0}, - {364, 0, 0}, - {368, 0, 0}, - {372, 0, 0}, - {376, 0, 0}, - {384, 0, 0}, - {392, 0, 0}, - {400, 0, 0}, - {416, 0, 0}, - {424, 0, 0}, - {432, 0, 0}, - {448, 0, 0}, - {460, 0, 0}, - {464, 0, 0}, - {468, 0, 0}, - {472, 0, 0}, - {476, 0, 0}, - {480, 0, 0}, - {488, 0, 0}, - {492, 0, 0}, - {496, 0, 0}, - {512, 0, 0}, - {640, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 14, 17}, - {0, 37, 31}, - {0, 21, 39}, - {0, 24, 23}, - {0, 5, 13}, - {0, 38, 76}, - {0, 51, 77}, - {0, 55, 53}, - {0, 58, 56}, - {0, 64, 61}, - {0, 67, 66}, - {0, 70, 68}, - {0, 54, 71}, - {0, 62, 60}, - {0, 65, 63}, - {0, 73, 72}, - {0, 59, 57}, - {0, 52, 74}, - {0, 50, 69}, - {0, 49, 47}, - {0, 48, 46}, - {0, 45, 43}, - {0, 42, 44}, - {0, 78, 41}, - {0, 20, 18}, - {0, 80, 79}, - {0, 15, 27}, - {0, 7, 34}, - {0, 81, 6}, - {0, 28, 3}, - {0, 35, 82}, - {0, 9, 36}, - {0, 84, 83}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - {0, 96, 95}, - {0, 98, 97}, - {0, 11, 29}, - {0, 99, 25}, - {0, 100, 40}, - {0, 102, 101}, - {0, 26, 32}, - {0, 19, 30}, - {0, 16, 12}, - {0, 4, 8}, - {0, 104, 103}, - {0, 106, 105}, - {0, 33, 107}, - {0, 109, 108}, - {0, 111, 110}, - {0, 22, 112}, - {0, 113, 10}, - {0, 115, 114}, - {0, 75, 116}, - {0, 118, 117}, - {0, 119, 1}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 127, 126}, - {0, 129, 128}, - {0, 131, 130}, - {0, 132, 2}, - {0, 134, 133}, - {0, 136, 135}, - {0, 138, 137}, - {0, 140, 139}, - {0, 142, 141}, - {0, 144, 143}, - {0, 146, 145}, - {0, 148, 147}, - })); - - codecs.emplace(std::pair(SpvOpMemberDecorate, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 6}, - {0, 4, 7}, - {0, 8, 3}, - {0, 9, 5}, - {0, 1, 10}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 7}, - {0, 8, 5}, - {0, 9, 1}, - {0, 4, 10}, - {0, 11, 6}, - {0, 2, 12}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 8}, - {0, 5, 2}, - {0, 10, 9}, - {0, 1, 4}, - {0, 12, 11}, - {0, 7, 13}, - {0, 3, 14}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 5}, - {0, 9, 7}, - {0, 10, 3}, - {0, 11, 2}, - {0, 6, 1}, - {0, 13, 12}, - {0, 4, 14}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 7), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(61, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {11, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {14, 0, 0}, - {15, 0, 0}, - {16, 0, 0}, - {17, 0, 0}, - {18, 0, 0}, - {19, 0, 0}, - {20, 0, 0}, - {21, 0, 0}, - {22, 0, 0}, - {23, 0, 0}, - {24, 0, 0}, - {27, 0, 0}, - {28, 0, 0}, - {29, 0, 0}, - {30, 0, 0}, - {31, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 30, 16}, - {0, 26, 27}, - {0, 29, 28}, - {0, 18, 22}, - {0, 12, 19}, - {0, 15, 20}, - {0, 14, 23}, - {0, 32, 7}, - {0, 8, 21}, - {0, 11, 33}, - {0, 17, 34}, - {0, 25, 13}, - {0, 36, 35}, - {0, 9, 10}, - {0, 38, 37}, - {0, 39, 31}, - {0, 5, 40}, - {0, 42, 41}, - {0, 44, 43}, - {0, 6, 45}, - {0, 46, 24}, - {0, 48, 47}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 55, 4}, - {0, 56, 3}, - {0, 57, 2}, - {0, 58, 1}, - {0, 60, 59}, - })); - - codecs.emplace(std::pair(SpvOpCompositeExtract, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(63, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {11, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {29, 0, 0}, - {30, 0, 0}, - {31, 0, 0}, - {32, 0, 0}, - {33, 0, 0}, - {34, 0, 0}, - {35, 0, 0}, - {36, 0, 0}, - {37, 0, 0}, - {38, 0, 0}, - {39, 0, 0}, - {40, 0, 0}, - {41, 0, 0}, - {42, 0, 0}, - {43, 0, 0}, - {44, 0, 0}, - {45, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 13, 14}, - {0, 12, 9}, - {0, 11, 25}, - {0, 27, 26}, - {0, 29, 28}, - {0, 31, 30}, - {0, 23, 22}, - {0, 10, 24}, - {0, 8, 21}, - {0, 17, 7}, - {0, 19, 18}, - {0, 15, 20}, - {0, 6, 16}, - {0, 5, 33}, - {0, 35, 34}, - {0, 37, 36}, - {0, 39, 38}, - {0, 41, 40}, - {0, 43, 42}, - {0, 45, 44}, - {0, 47, 46}, - {0, 49, 48}, - {0, 51, 50}, - {0, 32, 52}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 3, 2}, - {0, 59, 4}, - {0, 60, 1}, - {0, 62, 61}, - })); - - codecs.emplace(std::pair(SpvOpCompositeExtract, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 5}, - {0, 3, 2}, - {0, 6, 4}, - {0, 8, 7}, - })); - - codecs.emplace(std::pair(SpvOpCompositeExtract, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(23, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 12, 11}, - {0, 10, 13}, - {0, 9, 14}, - {0, 7, 5}, - {0, 8, 6}, - {0, 4, 15}, - {0, 17, 16}, - {0, 18, 3}, - {0, 19, 2}, - {0, 20, 1}, - {0, 22, 21}, - })); - - codecs.emplace(std::pair(SpvOpCompositeInsert, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {0, 0, 0}, - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 2, 6}, - {0, 7, 1}, - {0, 4, 8}, - })); - - codecs.emplace(std::pair(SpvOpCompositeInsert, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {2, 0, 0}, - {10, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {2, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleDrefExplicitLod, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {0, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpSelectionMerge, 1), std::move(codec)); - } - - return codecs; -} - -std::map, std::unique_ptr>> -GetIdDescriptorHuffmanCodecs() { - std::map, std::unique_ptr>> codecs; - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 4, 6}, - {0, 1, 7}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(63, { - {0, 0, 0}, - {34183582, 0, 0}, - {223800276, 0, 0}, - {295018543, 0, 0}, - {439764402, 0, 0}, - {443558693, 0, 0}, - {583624926, 0, 0}, - {599185303, 0, 0}, - {779021139, 0, 0}, - {1015552308, 0, 0}, - {1027242654, 0, 0}, - {1077859090, 0, 0}, - {1104362365, 0, 0}, - {1132589448, 0, 0}, - {1236389532, 0, 0}, - {1739837626, 0, 0}, - {1955104493, 0, 0}, - {2161102232, 0, 0}, - {2197874825, 0, 0}, - {2217833278, 0, 0}, - {2244470522, 0, 0}, - {2532518896, 0, 0}, - {2789375411, 0, 0}, - {3061690214, 0, 0}, - {3287039847, 0, 0}, - {3357301402, 0, 0}, - {3365041621, 0, 0}, - {3510257966, 0, 0}, - {3534235309, 0, 0}, - {4018237905, 0, 0}, - {4145966869, 0, 0}, - {4272200782, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 10, 19}, - {0, 6, 1}, - {0, 26, 13}, - {0, 2, 11}, - {0, 15, 22}, - {0, 23, 18}, - {0, 4, 27}, - {0, 28, 12}, - {0, 3, 30}, - {0, 9, 7}, - {0, 20, 14}, - {0, 29, 16}, - {0, 21, 8}, - {0, 34, 33}, - {0, 36, 35}, - {0, 31, 25}, - {0, 37, 24}, - {0, 39, 38}, - {0, 41, 40}, - {0, 43, 42}, - {0, 45, 44}, - {0, 17, 5}, - {0, 47, 46}, - {0, 49, 48}, - {0, 51, 50}, - {0, 53, 52}, - {0, 55, 54}, - {0, 57, 56}, - {0, 59, 58}, - {0, 61, 60}, - {0, 32, 62}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {4228502127, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(113, { - {0, 0, 0}, - {50998433, 0, 0}, - {139011596, 0, 0}, - {181902171, 0, 0}, - {296981500, 0, 0}, - {321630747, 0, 0}, - {416853049, 0, 0}, - {464259778, 0, 0}, - {615982737, 0, 0}, - {669982125, 0, 0}, - {759277550, 0, 0}, - {810488476, 0, 0}, - {870594305, 0, 0}, - {922996215, 0, 0}, - {969500141, 0, 0}, - {1015552308, 0, 0}, - {1139547465, 0, 0}, - {1203545131, 0, 0}, - {1220643281, 0, 0}, - {1220749418, 0, 0}, - {1367301635, 0, 0}, - {1395923345, 0, 0}, - {1554194368, 0, 0}, - {1742737136, 0, 0}, - {1755648697, 0, 0}, - {1962162282, 0, 0}, - {1964254745, 0, 0}, - {2055836767, 0, 0}, - {2096388952, 0, 0}, - {2124837447, 0, 0}, - {2161102232, 0, 0}, - {2321729979, 0, 0}, - {2346547796, 0, 0}, - {2399809085, 0, 0}, - {2432827426, 0, 0}, - {2455417440, 0, 0}, - {2572638469, 0, 0}, - {2614879967, 0, 0}, - {2855506940, 0, 0}, - {2919796598, 0, 0}, - {2970183398, 0, 0}, - {2976066508, 0, 0}, - {3044188332, 0, 0}, - {3061690214, 0, 0}, - {3091876332, 0, 0}, - {3104643263, 0, 0}, - {3107165180, 0, 0}, - {3187066832, 0, 0}, - {3413713311, 0, 0}, - {3487022798, 0, 0}, - {3602693817, 0, 0}, - {3678875745, 0, 0}, - {3701632935, 0, 0}, - {3829325073, 0, 0}, - {4040340620, 0, 0}, - {4174489262, 0, 0}, - {4272200782, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 33, 7}, - {0, 13, 34}, - {0, 21, 18}, - {0, 53, 22}, - {0, 39, 1}, - {0, 14, 9}, - {0, 43, 26}, - {0, 51, 35}, - {0, 19, 6}, - {0, 15, 25}, - {0, 55, 29}, - {0, 32, 3}, - {0, 27, 44}, - {0, 10, 46}, - {0, 45, 24}, - {0, 36, 40}, - {0, 47, 8}, - {0, 48, 54}, - {0, 58, 5}, - {0, 60, 59}, - {0, 30, 61}, - {0, 62, 56}, - {0, 64, 63}, - {0, 41, 50}, - {0, 66, 65}, - {0, 68, 67}, - {0, 70, 69}, - {0, 37, 31}, - {0, 4, 17}, - {0, 16, 20}, - {0, 72, 71}, - {0, 73, 52}, - {0, 49, 12}, - {0, 75, 74}, - {0, 76, 11}, - {0, 23, 42}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - {0, 84, 83}, - {0, 85, 28}, - {0, 87, 86}, - {0, 89, 88}, - {0, 91, 90}, - {0, 93, 92}, - {0, 94, 2}, - {0, 96, 95}, - {0, 98, 97}, - {0, 100, 99}, - {0, 102, 101}, - {0, 38, 103}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 57, 112}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(127, { - {0, 0, 0}, - {72782198, 0, 0}, - {139011596, 0, 0}, - {296981500, 0, 0}, - {300939750, 0, 0}, - {401211099, 0, 0}, - {429277936, 0, 0}, - {505940164, 0, 0}, - {538168945, 0, 0}, - {603915804, 0, 0}, - {688216667, 0, 0}, - {706016261, 0, 0}, - {790502615, 0, 0}, - {810488476, 0, 0}, - {993150979, 0, 0}, - {1203545131, 0, 0}, - {1206726575, 0, 0}, - {1265796414, 0, 0}, - {1314843976, 0, 0}, - {1367301635, 0, 0}, - {1378082995, 0, 0}, - {1410311776, 0, 0}, - {1443829854, 0, 0}, - {1448448666, 0, 0}, - {1468919488, 0, 0}, - {1496351055, 0, 0}, - {1619778288, 0, 0}, - {1684282922, 0, 0}, - {1848784182, 0, 0}, - {1901166356, 0, 0}, - {2095546797, 0, 0}, - {2096388952, 0, 0}, - {2162986400, 0, 0}, - {2197874825, 0, 0}, - {2246405597, 0, 0}, - {2250225826, 0, 0}, - {2282454607, 0, 0}, - {2328748202, 0, 0}, - {2348201466, 0, 0}, - {2597020383, 0, 0}, - {2633682514, 0, 0}, - {2817335337, 0, 0}, - {2855506940, 0, 0}, - {2936040203, 0, 0}, - {2955375511, 0, 0}, - {3122368657, 0, 0}, - {3154597438, 0, 0}, - {3184381405, 0, 0}, - {3187066832, 0, 0}, - {3233393284, 0, 0}, - {3251128023, 0, 0}, - {3260309823, 0, 0}, - {3441531391, 0, 0}, - {3496407048, 0, 0}, - {3582002820, 0, 0}, - {3647586740, 0, 0}, - {3653838348, 0, 0}, - {3730093054, 0, 0}, - {3759072440, 0, 0}, - {3928764629, 0, 0}, - {3969279737, 0, 0}, - {3994511488, 0, 0}, - {4026740269, 0, 0}, - {4274214049, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 43, 23}, - {0, 5, 24}, - {0, 9, 8}, - {0, 36, 21}, - {0, 13, 46}, - {0, 7, 12}, - {0, 35, 20}, - {0, 61, 59}, - {0, 22, 29}, - {0, 38, 62}, - {0, 56, 45}, - {0, 6, 48}, - {0, 33, 30}, - {0, 14, 58}, - {0, 34, 28}, - {0, 51, 40}, - {0, 63, 55}, - {0, 25, 16}, - {0, 17, 11}, - {0, 53, 52}, - {0, 65, 27}, - {0, 39, 41}, - {0, 67, 66}, - {0, 69, 68}, - {0, 10, 4}, - {0, 37, 18}, - {0, 60, 47}, - {0, 1, 32}, - {0, 71, 70}, - {0, 73, 72}, - {0, 57, 26}, - {0, 74, 31}, - {0, 76, 75}, - {0, 77, 44}, - {0, 78, 15}, - {0, 79, 54}, - {0, 81, 80}, - {0, 82, 49}, - {0, 84, 83}, - {0, 86, 85}, - {0, 88, 87}, - {0, 89, 19}, - {0, 91, 90}, - {0, 93, 92}, - {0, 95, 94}, - {0, 2, 96}, - {0, 98, 97}, - {0, 100, 99}, - {0, 102, 101}, - {0, 104, 103}, - {0, 106, 105}, - {0, 3, 107}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 114, 50}, - {0, 116, 115}, - {0, 118, 117}, - {0, 120, 119}, - {0, 122, 121}, - {0, 124, 123}, - {0, 64, 42}, - {0, 126, 125}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(93, { - {0, 0, 0}, - {99347751, 0, 0}, - {102542696, 0, 0}, - {107497541, 0, 0}, - {112452386, 0, 0}, - {139011596, 0, 0}, - {296981500, 0, 0}, - {429277936, 0, 0}, - {451957774, 0, 0}, - {508217552, 0, 0}, - {573901046, 0, 0}, - {774727851, 0, 0}, - {801484894, 0, 0}, - {920604853, 0, 0}, - {925559698, 0, 0}, - {1022915255, 0, 0}, - {1209418480, 0, 0}, - {1287937401, 0, 0}, - {1319785741, 0, 0}, - {1392080469, 0, 0}, - {1538342947, 0, 0}, - {1541020250, 0, 0}, - {1587209598, 0, 0}, - {1594733696, 0, 0}, - {1631434666, 0, 0}, - {1636389511, 0, 0}, - {1684282922, 0, 0}, - {1859128680, 0, 0}, - {1901166356, 0, 0}, - {2004567202, 0, 0}, - {2119793999, 0, 0}, - {2280400314, 0, 0}, - {2538917932, 0, 0}, - {2677264274, 0, 0}, - {2683080096, 0, 0}, - {2854085372, 0, 0}, - {2879917501, 0, 0}, - {3059119137, 0, 0}, - {3174324790, 0, 0}, - {3194725903, 0, 0}, - {3358097187, 0, 0}, - {3547456240, 0, 0}, - {3614752756, 0, 0}, - {3753486980, 0, 0}, - {3811268385, 0, 0}, - {3953733490, 0, 0}, - {3990925720, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 23, 22}, - {0, 36, 31}, - {0, 17, 40}, - {0, 27, 19}, - {0, 35, 33}, - {0, 30, 38}, - {0, 42, 39}, - {0, 46, 32}, - {0, 13, 12}, - {0, 44, 14}, - {0, 29, 11}, - {0, 10, 18}, - {0, 15, 37}, - {0, 1, 4}, - {0, 45, 2}, - {0, 21, 28}, - {0, 8, 5}, - {0, 49, 48}, - {0, 51, 50}, - {0, 53, 52}, - {0, 54, 16}, - {0, 55, 25}, - {0, 56, 3}, - {0, 58, 57}, - {0, 59, 26}, - {0, 20, 7}, - {0, 61, 60}, - {0, 62, 24}, - {0, 41, 63}, - {0, 65, 64}, - {0, 9, 34}, - {0, 67, 66}, - {0, 69, 68}, - {0, 71, 70}, - {0, 73, 72}, - {0, 75, 74}, - {0, 76, 43}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - {0, 84, 83}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 47, 91}, - {0, 92, 6}, - })); - - codecs.emplace(std::pair(SpvOpExtInst, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {166253838, 0, 0}, - {679771963, 0, 0}, - {1247793383, 0, 0}, - {2261697609, 0, 0}, - {2263349224, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 8}, - {0, 9, 1}, - {0, 3, 5}, - {0, 11, 10}, - {0, 2, 12}, - {0, 7, 6}, - {0, 14, 13}, - })); - - codecs.emplace(std::pair(SpvOpTypeVector, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {789872778, 0, 0}, - {1415510495, 0, 0}, - {1951208733, 0, 0}, - {2430404313, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 5}, - {0, 4, 6}, - {0, 7, 1}, - {0, 3, 8}, - })); - - codecs.emplace(std::pair(SpvOpTypeVector, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {1389644742, 0, 0}, - {3232633974, 0, 0}, - {3278176820, 0, 0}, - {3648138580, 0, 0}, - {3687777340, 0, 0}, - {3694383800, 0, 0}, - {3697687030, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 4}, - {0, 9, 6}, - {0, 10, 8}, - {0, 2, 11}, - {0, 12, 3}, - {0, 1, 13}, - {0, 14, 7}, - })); - - codecs.emplace(std::pair(SpvOpTypeArray, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {1951208733, 0, 0}, - {2160380860, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 2, 5}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeArray, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {144116905, 0, 0}, - {827246872, 0, 0}, - {1545298048, 0, 0}, - {2715370488, 0, 0}, - {2798552666, 0, 0}, - {3812456892, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 8, 6}, - {0, 9, 7}, - {0, 1, 10}, - {0, 11, 4}, - {0, 5, 12}, - })); - - codecs.emplace(std::pair(SpvOpTypeArray, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(67, { - {0, 0, 0}, - {40653745, 0, 0}, - {119981689, 0, 0}, - {153085016, 0, 0}, - {451382997, 0, 0}, - {545678922, 0, 0}, - {899570100, 0, 0}, - {929101967, 0, 0}, - {1070791291, 0, 0}, - {1100599986, 0, 0}, - {1103903216, 0, 0}, - {1154919607, 0, 0}, - {1199157863, 0, 0}, - {1258105452, 0, 0}, - {1369578001, 0, 0}, - {1372881231, 0, 0}, - {1674803691, 0, 0}, - {1677700667, 0, 0}, - {1989520052, 0, 0}, - {2593884753, 0, 0}, - {2664825925, 0, 0}, - {2924146124, 0, 0}, - {2926633629, 0, 0}, - {3249265647, 0, 0}, - {3345288309, 0, 0}, - {3410158390, 0, 0}, - {3489360962, 0, 0}, - {3495967422, 0, 0}, - {3504981554, 0, 0}, - {3705139860, 0, 0}, - {3822983876, 0, 0}, - {4141567741, 0, 0}, - {4234287173, 0, 0}, - {4240893633, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 15, 23}, - {0, 20, 17}, - {0, 32, 22}, - {0, 19, 12}, - {0, 13, 3}, - {0, 30, 27}, - {0, 4, 35}, - {0, 24, 36}, - {0, 31, 37}, - {0, 33, 38}, - {0, 39, 7}, - {0, 6, 40}, - {0, 41, 29}, - {0, 14, 42}, - {0, 43, 28}, - {0, 10, 44}, - {0, 45, 18}, - {0, 26, 46}, - {0, 5, 47}, - {0, 48, 2}, - {0, 49, 9}, - {0, 50, 16}, - {0, 34, 25}, - {0, 52, 51}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 60, 59}, - {0, 8, 21}, - {0, 1, 11}, - {0, 62, 61}, - {0, 64, 63}, - {0, 66, 65}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2160380860, 0, 0}, - {3278176820, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 6}, - {0, 2, 7}, - {0, 3, 8}, - {0, 9, 1}, - {0, 5, 10}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2160380860, 0, 0}, - {2320303498, 0, 0}, - {3232633974, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 7}, - {0, 2, 8}, - {0, 4, 9}, - {0, 10, 3}, - {0, 1, 6}, - {0, 12, 11}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2160380860, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 6}, - {0, 1, 7}, - {0, 3, 4}, - {0, 8, 2}, - {0, 10, 9}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2160380860, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 6}, - {0, 3, 7}, - {0, 5, 4}, - {0, 8, 1}, - {0, 10, 9}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2263349224, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 1, 6}, - {0, 2, 7}, - {0, 8, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 1, 6}, - {0, 2, 7}, - {0, 8, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 4, 6}, - {0, 7, 1}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 7), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 1, 6}, - {0, 7, 4}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 8), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 4}, - {0, 3, 5}, - {0, 1, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 9), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 3}, - {0, 1, 6}, - {0, 4, 7}, - {0, 8, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 10), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 1, 6}, - {0, 7, 4}, - {0, 8, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 11), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 4, 1}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 12), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 13), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 5}, - {0, 3, 6}, - {0, 7, 1}, - {0, 8, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 14), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 5, 3}, - {0, 6, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 15), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 2, 5}, - {0, 1, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 16), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 4, 6}, - {0, 7, 1}, - {0, 8, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 17), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 18), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 3, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 19), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 20), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 2, 5}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 21), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 1}, - {0, 2, 6}, - {0, 3, 7}, - {0, 8, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 22), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 5}, - {0, 2, 6}, - {0, 4, 7}, - {0, 8, 3}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 23), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2160380860, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 4}, - {0, 1, 7}, - {0, 2, 8}, - {0, 3, 9}, - {0, 10, 5}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 24), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 5}, - {0, 2, 6}, - {0, 4, 7}, - {0, 8, 3}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 25), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 2, 5}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 26), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 2, 5}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 27), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 28), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 29), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 30), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 3}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 31), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 32), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 33), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 3}, - {0, 2, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 34), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 35), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 36), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 37), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1389644742, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 38), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {3697687030, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 39), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 40), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 41), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 42), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 43), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 44), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 45), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 46), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 47), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 48), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 49), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 50), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {679771963, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpTypeStruct, 51), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(101, { - {0, 0, 0}, - {85880059, 0, 0}, - {135486769, 0, 0}, - {304448521, 0, 0}, - {436416061, 0, 0}, - {440421571, 0, 0}, - {450406196, 0, 0}, - {503094540, 0, 0}, - {543621065, 0, 0}, - {626892406, 0, 0}, - {628544021, 0, 0}, - {827698488, 0, 0}, - {869050696, 0, 0}, - {907126242, 0, 0}, - {908777857, 0, 0}, - {910429472, 0, 0}, - {1113409935, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {1322549027, 0, 0}, - {1784441183, 0, 0}, - {2080953106, 0, 0}, - {2194691858, 0, 0}, - {2448331885, 0, 0}, - {2466255445, 0, 0}, - {2468230023, 0, 0}, - {2547657777, 0, 0}, - {2549309392, 0, 0}, - {2550961007, 0, 0}, - {2894051250, 0, 0}, - {2929019254, 0, 0}, - {2934934694, 0, 0}, - {2936586309, 0, 0}, - {2938237924, 0, 0}, - {3077271274, 0, 0}, - {3092528578, 0, 0}, - {3094180193, 0, 0}, - {3094857332, 0, 0}, - {3095831808, 0, 0}, - {3183924418, 0, 0}, - {3207966516, 0, 0}, - {3282979782, 0, 0}, - {3433956341, 0, 0}, - {3561562003, 0, 0}, - {3563213618, 0, 0}, - {3564865233, 0, 0}, - {3585511591, 0, 0}, - {4028622909, 0, 0}, - {4039938779, 0, 0}, - {4050155669, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 16, 25}, - {0, 50, 1}, - {0, 42, 35}, - {0, 31, 41}, - {0, 4, 43}, - {0, 9, 10}, - {0, 3, 30}, - {0, 52, 47}, - {0, 12, 53}, - {0, 55, 54}, - {0, 36, 56}, - {0, 49, 57}, - {0, 6, 58}, - {0, 34, 33}, - {0, 59, 26}, - {0, 21, 32}, - {0, 60, 15}, - {0, 24, 61}, - {0, 62, 38}, - {0, 22, 2}, - {0, 37, 7}, - {0, 63, 46}, - {0, 14, 13}, - {0, 64, 5}, - {0, 65, 45}, - {0, 66, 19}, - {0, 18, 67}, - {0, 17, 20}, - {0, 68, 11}, - {0, 8, 69}, - {0, 70, 39}, - {0, 72, 71}, - {0, 74, 73}, - {0, 40, 75}, - {0, 76, 23}, - {0, 78, 77}, - {0, 29, 79}, - {0, 28, 80}, - {0, 27, 48}, - {0, 82, 81}, - {0, 51, 83}, - {0, 84, 44}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - {0, 96, 95}, - {0, 98, 97}, - {0, 100, 99}, - })); - - codecs.emplace(std::pair(SpvOpTypePointer, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(65, { - {0, 0, 0}, - {119981689, 0, 0}, - {162255877, 0, 0}, - {451382997, 0, 0}, - {545678922, 0, 0}, - {679771963, 0, 0}, - {789872778, 0, 0}, - {1100599986, 0, 0}, - {1103903216, 0, 0}, - {1154919607, 0, 0}, - {1343794461, 0, 0}, - {1415510495, 0, 0}, - {1674803691, 0, 0}, - {1951208733, 0, 0}, - {1989520052, 0, 0}, - {2160380860, 0, 0}, - {2263349224, 0, 0}, - {2320303498, 0, 0}, - {2924146124, 0, 0}, - {2984325996, 0, 0}, - {3334207724, 0, 0}, - {3345288309, 0, 0}, - {3410158390, 0, 0}, - {3489360962, 0, 0}, - {3495967422, 0, 0}, - {3504981554, 0, 0}, - {3800912395, 0, 0}, - {3802564010, 0, 0}, - {3866587616, 0, 0}, - {3868239231, 0, 0}, - {3869890846, 0, 0}, - {3998230222, 0, 0}, - {4240893633, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 3}, - {0, 6, 24}, - {0, 11, 7}, - {0, 32, 21}, - {0, 27, 34}, - {0, 35, 25}, - {0, 36, 8}, - {0, 26, 31}, - {0, 14, 15}, - {0, 28, 37}, - {0, 1, 23}, - {0, 39, 38}, - {0, 12, 40}, - {0, 22, 41}, - {0, 10, 16}, - {0, 43, 42}, - {0, 29, 44}, - {0, 2, 45}, - {0, 46, 19}, - {0, 48, 47}, - {0, 18, 49}, - {0, 50, 30}, - {0, 9, 33}, - {0, 52, 51}, - {0, 54, 53}, - {0, 13, 55}, - {0, 17, 56}, - {0, 5, 57}, - {0, 59, 58}, - {0, 60, 20}, - {0, 62, 61}, - {0, 64, 63}, - })); - - codecs.emplace(std::pair(SpvOpTypePointer, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(99, { - {0, 0, 0}, - {75986790, 0, 0}, - {95470391, 0, 0}, - {170378107, 0, 0}, - {172029722, 0, 0}, - {204234270, 0, 0}, - {205885885, 0, 0}, - {244668133, 0, 0}, - {265778447, 0, 0}, - {616435646, 0, 0}, - {618087261, 0, 0}, - {753954113, 0, 0}, - {1000070091, 0, 0}, - {1308462133, 0, 0}, - {1671139745, 0, 0}, - {1774874546, 0, 0}, - {1776526161, 0, 0}, - {1887808856, 0, 0}, - {1889460471, 0, 0}, - {1917966999, 0, 0}, - {2044728014, 0, 0}, - {2192810893, 0, 0}, - {2293247016, 0, 0}, - {2503194620, 0, 0}, - {2605012269, 0, 0}, - {2608484640, 0, 0}, - {2615111110, 0, 0}, - {2668769415, 0, 0}, - {2759951687, 0, 0}, - {2761603302, 0, 0}, - {2856623532, 0, 0}, - {2945369269, 0, 0}, - {2956189845, 0, 0}, - {3085119011, 0, 0}, - {3367313400, 0, 0}, - {3447882276, 0, 0}, - {3633746133, 0, 0}, - {3635397748, 0, 0}, - {3710645347, 0, 0}, - {3712296962, 0, 0}, - {3715846592, 0, 0}, - {3727494858, 0, 0}, - {3747079365, 0, 0}, - {3748965853, 0, 0}, - {3750617468, 0, 0}, - {4018820793, 0, 0}, - {4022124023, 0, 0}, - {4024173916, 0, 0}, - {4215670524, 0, 0}, - {4217322139, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 10, 9}, - {0, 31, 24}, - {0, 40, 13}, - {0, 45, 33}, - {0, 34, 46}, - {0, 43, 38}, - {0, 44, 15}, - {0, 11, 30}, - {0, 21, 6}, - {0, 47, 3}, - {0, 51, 16}, - {0, 14, 52}, - {0, 8, 53}, - {0, 35, 5}, - {0, 55, 54}, - {0, 56, 26}, - {0, 20, 57}, - {0, 39, 19}, - {0, 59, 58}, - {0, 61, 60}, - {0, 4, 62}, - {0, 2, 63}, - {0, 25, 7}, - {0, 64, 27}, - {0, 12, 22}, - {0, 65, 48}, - {0, 41, 42}, - {0, 17, 23}, - {0, 49, 66}, - {0, 68, 67}, - {0, 70, 69}, - {0, 72, 71}, - {0, 74, 73}, - {0, 18, 75}, - {0, 37, 32}, - {0, 76, 36}, - {0, 78, 77}, - {0, 79, 28}, - {0, 81, 80}, - {0, 82, 29}, - {0, 84, 83}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 91, 50}, - {0, 93, 92}, - {0, 95, 94}, - {0, 1, 96}, - {0, 98, 97}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(27, { - {0, 0, 0}, - {545678922, 0, 0}, - {679771963, 0, 0}, - {899570100, 0, 0}, - {929101967, 0, 0}, - {1100599986, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3056042030, 0, 0}, - {3334207724, 0, 0}, - {3357250579, 0, 0}, - {3705139860, 0, 0}, - {3800912395, 0, 0}, - {3802564010, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 3}, - {0, 10, 13}, - {0, 4, 15}, - {0, 16, 11}, - {0, 17, 1}, - {0, 14, 12}, - {0, 19, 18}, - {0, 21, 20}, - {0, 7, 6}, - {0, 9, 22}, - {0, 24, 23}, - {0, 25, 2}, - {0, 26, 8}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(57, { - {0, 0, 0}, - {283209196, 0, 0}, - {436416061, 0, 0}, - {679771963, 0, 0}, - {789872778, 0, 0}, - {815757910, 0, 0}, - {827698488, 0, 0}, - {1164221089, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {1525861001, 0, 0}, - {1579585816, 0, 0}, - {1675764636, 0, 0}, - {1824016656, 0, 0}, - {1951208733, 0, 0}, - {1991787192, 0, 0}, - {2180701723, 0, 0}, - {2194691858, 0, 0}, - {2320303498, 0, 0}, - {2881886868, 0, 0}, - {2926633629, 0, 0}, - {3249265647, 0, 0}, - {3334207724, 0, 0}, - {3472123498, 0, 0}, - {3674863070, 0, 0}, - {4050155669, 0, 0}, - {4141567741, 0, 0}, - {4155122613, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 24, 7}, - {0, 17, 1}, - {0, 4, 15}, - {0, 11, 16}, - {0, 28, 30}, - {0, 25, 20}, - {0, 14, 31}, - {0, 32, 26}, - {0, 12, 5}, - {0, 2, 22}, - {0, 33, 13}, - {0, 35, 34}, - {0, 37, 36}, - {0, 39, 38}, - {0, 40, 21}, - {0, 29, 18}, - {0, 27, 41}, - {0, 43, 42}, - {0, 19, 44}, - {0, 45, 23}, - {0, 6, 3}, - {0, 47, 46}, - {0, 49, 48}, - {0, 51, 50}, - {0, 10, 8}, - {0, 53, 52}, - {0, 9, 54}, - {0, 56, 55}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(17, { - {0, 0, 0}, - {679771963, 0, 0}, - {827698488, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 9}, - {0, 10, 6}, - {0, 1, 5}, - {0, 11, 3}, - {0, 12, 7}, - {0, 13, 2}, - {0, 15, 14}, - {0, 16, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(17, { - {0, 0, 0}, - {679771963, 0, 0}, - {827698488, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1951208733, 0, 0}, - {2194691858, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 5}, - {0, 10, 9}, - {0, 11, 6}, - {0, 7, 12}, - {0, 1, 3}, - {0, 2, 13}, - {0, 15, 14}, - {0, 4, 16}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {827698488, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 6}, - {0, 5, 7}, - {0, 2, 8}, - {0, 1, 9}, - {0, 10, 3}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {827698488, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1951208733, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 6}, - {0, 4, 7}, - {0, 8, 5}, - {0, 3, 9}, - {0, 1, 10}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {789872778, 0, 0}, - {827698488, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 1}, - {0, 4, 6}, - {0, 3, 7}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 7), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {543621065, 0, 0}, - {827698488, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 8), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {827698488, 0, 0}, - {1951208733, 0, 0}, - {3095831808, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 4}, - {0, 3, 5}, - {0, 1, 6}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 9), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1296054774, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 10), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {1296054774, 0, 0}, - {2320303498, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 1, 4}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 11), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {789872778, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 4, 1}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 12), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {789872778, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 1}, - {0, 4, 3}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 13), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 1}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 14), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 1}, - })); - - codecs.emplace(std::pair(SpvOpTypeFunction, 15), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {789872778, 0, 0}, - {1951208733, 0, 0}, - {2430404313, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 1, 5}, - {0, 2, 6}, - })); - - codecs.emplace(std::pair(SpvOpConstant, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(183, { - {0, 0, 0}, - {51041423, 0, 0}, - {52882140, 0, 0}, - {72782198, 0, 0}, - {142465290, 0, 0}, - {144116905, 0, 0}, - {158160339, 0, 0}, - {169135842, 0, 0}, - {210116709, 0, 0}, - {290391815, 0, 0}, - {296981500, 0, 0}, - {385229009, 0, 0}, - {438318340, 0, 0}, - {529742207, 0, 0}, - {628331516, 0, 0}, - {677668732, 0, 0}, - {778500192, 0, 0}, - {825595257, 0, 0}, - {910398460, 0, 0}, - {917019124, 0, 0}, - {959681532, 0, 0}, - {1031290113, 0, 0}, - {1039111164, 0, 0}, - {1064945649, 0, 0}, - {1087394637, 0, 0}, - {1092948665, 0, 0}, - {1156369516, 0, 0}, - {1158021131, 0, 0}, - {1172110445, 0, 0}, - {1304296041, 0, 0}, - {1400019344, 0, 0}, - {1450415100, 0, 0}, - {1452222566, 0, 0}, - {1543646433, 0, 0}, - {1543672828, 0, 0}, - {1612361408, 0, 0}, - {1622381564, 0, 0}, - {1691572958, 0, 0}, - {1755648697, 0, 0}, - {1782996825, 0, 0}, - {1784648440, 0, 0}, - {1930923350, 0, 0}, - {1939359710, 0, 0}, - {1971252067, 0, 0}, - {1979847999, 0, 0}, - {2078849875, 0, 0}, - {2113115132, 0, 0}, - {2135340676, 0, 0}, - {2170273742, 0, 0}, - {2268204687, 0, 0}, - {2285081596, 0, 0}, - {2318200267, 0, 0}, - {2321729979, 0, 0}, - {2326636627, 0, 0}, - {2444465148, 0, 0}, - {2466126792, 0, 0}, - {2490492987, 0, 0}, - {2524697596, 0, 0}, - {2557550659, 0, 0}, - {2678954464, 0, 0}, - {2705477184, 0, 0}, - {2715370488, 0, 0}, - {2732195517, 0, 0}, - {2775815164, 0, 0}, - {2796901051, 0, 0}, - {2798552666, 0, 0}, - {2855506940, 0, 0}, - {2860348412, 0, 0}, - {2922615804, 0, 0}, - {2937761472, 0, 0}, - {2944827576, 0, 0}, - {3092754101, 0, 0}, - {3107165180, 0, 0}, - {3168953855, 0, 0}, - {3184177968, 0, 0}, - {3202349435, 0, 0}, - {3266548732, 0, 0}, - {3332104493, 0, 0}, - {3362723943, 0, 0}, - {3571454885, 0, 0}, - {3712763835, 0, 0}, - {3743748793, 0, 0}, - {3810805277, 0, 0}, - {3912967080, 0, 0}, - {3929248764, 0, 0}, - {3958731802, 0, 0}, - {3997952447, 0, 0}, - {4016096296, 0, 0}, - {4106658327, 0, 0}, - {4172568578, 0, 0}, - {4198082194, 0, 0}, - {4248015868, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 35, 16}, - {0, 49, 42}, - {0, 86, 69}, - {0, 53, 30}, - {0, 45, 89}, - {0, 50, 68}, - {0, 73, 71}, - {0, 17, 46}, - {0, 14, 81}, - {0, 63, 44}, - {0, 12, 3}, - {0, 72, 31}, - {0, 55, 67}, - {0, 36, 19}, - {0, 22, 88}, - {0, 9, 70}, - {0, 93, 23}, - {0, 95, 94}, - {0, 47, 91}, - {0, 34, 32}, - {0, 97, 96}, - {0, 41, 61}, - {0, 99, 98}, - {0, 37, 1}, - {0, 77, 100}, - {0, 51, 60}, - {0, 101, 79}, - {0, 6, 2}, - {0, 11, 7}, - {0, 24, 21}, - {0, 43, 28}, - {0, 59, 56}, - {0, 75, 62}, - {0, 80, 78}, - {0, 87, 83}, - {0, 18, 15}, - {0, 102, 38}, - {0, 104, 103}, - {0, 85, 90}, - {0, 76, 25}, - {0, 29, 105}, - {0, 107, 106}, - {0, 58, 52}, - {0, 109, 108}, - {0, 57, 110}, - {0, 112, 111}, - {0, 114, 113}, - {0, 115, 33}, - {0, 74, 116}, - {0, 118, 117}, - {0, 120, 119}, - {0, 122, 121}, - {0, 124, 123}, - {0, 126, 125}, - {0, 128, 127}, - {0, 130, 129}, - {0, 131, 13}, - {0, 54, 27}, - {0, 133, 132}, - {0, 48, 40}, - {0, 5, 8}, - {0, 82, 134}, - {0, 26, 135}, - {0, 39, 4}, - {0, 136, 64}, - {0, 138, 137}, - {0, 140, 139}, - {0, 84, 141}, - {0, 143, 142}, - {0, 145, 144}, - {0, 147, 146}, - {0, 149, 148}, - {0, 20, 150}, - {0, 65, 151}, - {0, 66, 152}, - {0, 153, 10}, - {0, 155, 154}, - {0, 157, 156}, - {0, 159, 158}, - {0, 161, 160}, - {0, 163, 162}, - {0, 165, 164}, - {0, 167, 166}, - {0, 169, 168}, - {0, 170, 92}, - {0, 172, 171}, - {0, 174, 173}, - {0, 176, 175}, - {0, 178, 177}, - {0, 180, 179}, - {0, 182, 181}, - })); - - codecs.emplace(std::pair(SpvOpConstant, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1247793383, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 5}, - {0, 4, 6}, - {0, 1, 3}, - {0, 8, 7}, - })); - - codecs.emplace(std::pair(SpvOpConstantComposite, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(83, { - {0, 0, 0}, - {15502752, 0, 0}, - {46736908, 0, 0}, - {139011596, 0, 0}, - {149720480, 0, 0}, - {249378857, 0, 0}, - {251209228, 0, 0}, - {503145996, 0, 0}, - {836581417, 0, 0}, - {882718761, 0, 0}, - {1289566249, 0, 0}, - {1325348861, 0, 0}, - {1558001705, 0, 0}, - {1646147798, 0, 0}, - {1679946323, 0, 0}, - {1766401548, 0, 0}, - {1992893964, 0, 0}, - {2123388694, 0, 0}, - {2162986400, 0, 0}, - {2580096524, 0, 0}, - {2598189097, 0, 0}, - {2683080096, 0, 0}, - {2698156268, 0, 0}, - {2763960513, 0, 0}, - {3015046341, 0, 0}, - {3133016299, 0, 0}, - {3251128023, 0, 0}, - {3504158761, 0, 0}, - {3535289452, 0, 0}, - {3536941067, 0, 0}, - {3538592682, 0, 0}, - {3540244297, 0, 0}, - {3541895912, 0, 0}, - {3570219049, 0, 0}, - {3653838348, 0, 0}, - {3764205609, 0, 0}, - {3882634684, 0, 0}, - {3913885196, 0, 0}, - {3982047273, 0, 0}, - {4024252457, 0, 0}, - {4243119782, 0, 0}, - {4255182614, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 4}, - {0, 39, 2}, - {0, 38, 10}, - {0, 29, 41}, - {0, 23, 28}, - {0, 9, 24}, - {0, 44, 43}, - {0, 45, 6}, - {0, 20, 12}, - {0, 18, 33}, - {0, 19, 16}, - {0, 7, 46}, - {0, 48, 47}, - {0, 5, 49}, - {0, 13, 11}, - {0, 17, 14}, - {0, 25, 22}, - {0, 40, 36}, - {0, 1, 50}, - {0, 31, 30}, - {0, 51, 32}, - {0, 42, 52}, - {0, 54, 53}, - {0, 55, 15}, - {0, 37, 56}, - {0, 57, 34}, - {0, 59, 58}, - {0, 61, 60}, - {0, 35, 21}, - {0, 62, 26}, - {0, 64, 63}, - {0, 65, 27}, - {0, 3, 66}, - {0, 68, 67}, - {0, 70, 69}, - {0, 72, 71}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - })); - - codecs.emplace(std::pair(SpvOpConstantComposite, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(65, { - {0, 0, 0}, - {142465290, 0, 0}, - {158160339, 0, 0}, - {169135842, 0, 0}, - {210116709, 0, 0}, - {296981500, 0, 0}, - {615748604, 0, 0}, - {910398460, 0, 0}, - {959681532, 0, 0}, - {1039111164, 0, 0}, - {1087394637, 0, 0}, - {1156369516, 0, 0}, - {1450415100, 0, 0}, - {1543672828, 0, 0}, - {2100532220, 0, 0}, - {2170273742, 0, 0}, - {2285081596, 0, 0}, - {2326636627, 0, 0}, - {2444465148, 0, 0}, - {2732195517, 0, 0}, - {2763232252, 0, 0}, - {2796901051, 0, 0}, - {2855506940, 0, 0}, - {2922615804, 0, 0}, - {2937761472, 0, 0}, - {3202349435, 0, 0}, - {3362723943, 0, 0}, - {3712763835, 0, 0}, - {3810805277, 0, 0}, - {3929248764, 0, 0}, - {4016096296, 0, 0}, - {4172568578, 0, 0}, - {4248015868, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 12, 23}, - {0, 13, 6}, - {0, 20, 14}, - {0, 15, 24}, - {0, 17, 28}, - {0, 16, 31}, - {0, 7, 34}, - {0, 9, 32}, - {0, 36, 35}, - {0, 38, 37}, - {0, 40, 39}, - {0, 2, 8}, - {0, 10, 3}, - {0, 25, 19}, - {0, 27, 26}, - {0, 33, 30}, - {0, 11, 41}, - {0, 1, 21}, - {0, 18, 42}, - {0, 44, 43}, - {0, 46, 45}, - {0, 48, 47}, - {0, 29, 49}, - {0, 4, 50}, - {0, 52, 51}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 59, 5}, - {0, 61, 60}, - {0, 62, 22}, - {0, 64, 63}, - })); - - codecs.emplace(std::pair(SpvOpConstantComposite, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(57, { - {0, 0, 0}, - {52882140, 0, 0}, - {210116709, 0, 0}, - {296981500, 0, 0}, - {385229009, 0, 0}, - {615748604, 0, 0}, - {910398460, 0, 0}, - {959681532, 0, 0}, - {1031290113, 0, 0}, - {1039111164, 0, 0}, - {1172110445, 0, 0}, - {1450415100, 0, 0}, - {1543672828, 0, 0}, - {1622381564, 0, 0}, - {1782996825, 0, 0}, - {1971252067, 0, 0}, - {2100532220, 0, 0}, - {2268204687, 0, 0}, - {2326636627, 0, 0}, - {2444465148, 0, 0}, - {2490492987, 0, 0}, - {2678954464, 0, 0}, - {2763232252, 0, 0}, - {2855506940, 0, 0}, - {2922615804, 0, 0}, - {3912967080, 0, 0}, - {3929248764, 0, 0}, - {4172568578, 0, 0}, - {4248015868, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 11, 24}, - {0, 12, 5}, - {0, 22, 16}, - {0, 18, 17}, - {0, 30, 27}, - {0, 6, 13}, - {0, 9, 28}, - {0, 32, 31}, - {0, 34, 33}, - {0, 7, 35}, - {0, 4, 1}, - {0, 10, 8}, - {0, 20, 15}, - {0, 25, 21}, - {0, 36, 29}, - {0, 19, 37}, - {0, 39, 38}, - {0, 41, 40}, - {0, 43, 42}, - {0, 26, 44}, - {0, 45, 2}, - {0, 47, 46}, - {0, 49, 48}, - {0, 50, 14}, - {0, 51, 3}, - {0, 53, 52}, - {0, 54, 23}, - {0, 56, 55}, - })); - - codecs.emplace(std::pair(SpvOpConstantComposite, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(39, { - {0, 0, 0}, - {210116709, 0, 0}, - {296981500, 0, 0}, - {615748604, 0, 0}, - {910398460, 0, 0}, - {959681532, 0, 0}, - {1039111164, 0, 0}, - {1092948665, 0, 0}, - {1450415100, 0, 0}, - {1543672828, 0, 0}, - {1612361408, 0, 0}, - {2100532220, 0, 0}, - {2326636627, 0, 0}, - {2444465148, 0, 0}, - {2524697596, 0, 0}, - {2763232252, 0, 0}, - {2855506940, 0, 0}, - {3929248764, 0, 0}, - {4172568578, 0, 0}, - {4248015868, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 7}, - {0, 9, 3}, - {0, 15, 11}, - {0, 10, 21}, - {0, 18, 12}, - {0, 4, 20}, - {0, 22, 19}, - {0, 23, 6}, - {0, 14, 24}, - {0, 5, 25}, - {0, 27, 26}, - {0, 28, 17}, - {0, 30, 29}, - {0, 31, 13}, - {0, 1, 32}, - {0, 34, 33}, - {0, 16, 35}, - {0, 2, 36}, - {0, 38, 37}, - })); - - codecs.emplace(std::pair(SpvOpConstantComposite, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(35, { - {0, 0, 0}, - {296981500, 0, 0}, - {615748604, 0, 0}, - {673708384, 0, 0}, - {959681532, 0, 0}, - {1039111164, 0, 0}, - {1450415100, 0, 0}, - {1543672828, 0, 0}, - {1939359710, 0, 0}, - {2100532220, 0, 0}, - {2113115132, 0, 0}, - {2326636627, 0, 0}, - {2444465148, 0, 0}, - {2763232252, 0, 0}, - {2855506940, 0, 0}, - {3929248764, 0, 0}, - {4172568578, 0, 0}, - {4248015868, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 18, 3}, - {0, 6, 19}, - {0, 12, 4}, - {0, 17, 2}, - {0, 9, 7}, - {0, 20, 13}, - {0, 11, 8}, - {0, 10, 16}, - {0, 21, 15}, - {0, 5, 22}, - {0, 24, 23}, - {0, 26, 25}, - {0, 28, 27}, - {0, 29, 1}, - {0, 31, 30}, - {0, 33, 32}, - {0, 34, 14}, - })); - - codecs.emplace(std::pair(SpvOpConstantComposite, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(23, { - {0, 0, 0}, - {545678922, 0, 0}, - {679771963, 0, 0}, - {929101967, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3056042030, 0, 0}, - {3334207724, 0, 0}, - {3357250579, 0, 0}, - {3705139860, 0, 0}, - {3800912395, 0, 0}, - {3802564010, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 11}, - {0, 9, 3}, - {0, 1, 13}, - {0, 14, 10}, - {0, 12, 15}, - {0, 17, 16}, - {0, 18, 4}, - {0, 7, 5}, - {0, 20, 19}, - {0, 2, 21}, - {0, 22, 6}, - })); - - codecs.emplace(std::pair(SpvOpFunction, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(89, { - {0, 0, 0}, - {35240468, 0, 0}, - {123060826, 0, 0}, - {184634770, 0, 0}, - {359054425, 0, 0}, - {459968607, 0, 0}, - {619875033, 0, 0}, - {904486530, 0, 0}, - {945128292, 0, 0}, - {950731750, 0, 0}, - {1058429216, 0, 0}, - {1182296898, 0, 0}, - {1238120570, 0, 0}, - {1429389803, 0, 0}, - {1652168174, 0, 0}, - {1717510093, 0, 0}, - {1766422419, 0, 0}, - {1775308984, 0, 0}, - {1776629361, 0, 0}, - {1824526196, 0, 0}, - {1957265068, 0, 0}, - {1998433745, 0, 0}, - {2055664760, 0, 0}, - {2303184249, 0, 0}, - {2451531615, 0, 0}, - {2507457870, 0, 0}, - {2550501832, 0, 0}, - {2590402790, 0, 0}, - {2649103430, 0, 0}, - {2780190687, 0, 0}, - {2831059514, 0, 0}, - {3167253437, 0, 0}, - {3269075805, 0, 0}, - {3323202731, 0, 0}, - {3361419439, 0, 0}, - {3464197236, 0, 0}, - {3472029049, 0, 0}, - {3518630848, 0, 0}, - {3604842236, 0, 0}, - {3653985133, 0, 0}, - {4091916710, 0, 0}, - {4121643374, 0, 0}, - {4185590212, 0, 0}, - {4233562270, 0, 0}, - {4235213885, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 40}, - {0, 14, 31}, - {0, 7, 9}, - {0, 29, 27}, - {0, 18, 44}, - {0, 8, 5}, - {0, 10, 3}, - {0, 41, 37}, - {0, 42, 35}, - {0, 2, 1}, - {0, 47, 46}, - {0, 48, 4}, - {0, 11, 49}, - {0, 50, 36}, - {0, 19, 51}, - {0, 53, 52}, - {0, 55, 54}, - {0, 15, 12}, - {0, 26, 16}, - {0, 56, 21}, - {0, 25, 33}, - {0, 43, 24}, - {0, 57, 39}, - {0, 59, 58}, - {0, 61, 60}, - {0, 62, 34}, - {0, 64, 63}, - {0, 17, 30}, - {0, 66, 65}, - {0, 20, 67}, - {0, 13, 68}, - {0, 28, 69}, - {0, 70, 32}, - {0, 72, 71}, - {0, 73, 22}, - {0, 75, 74}, - {0, 77, 76}, - {0, 79, 78}, - {0, 80, 23}, - {0, 45, 81}, - {0, 83, 82}, - {0, 85, 84}, - {0, 38, 86}, - {0, 88, 87}, - })); - - codecs.emplace(std::pair(SpvOpFunction, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(87, { - {0, 0, 0}, - {75986790, 0, 0}, - {95470391, 0, 0}, - {170378107, 0, 0}, - {172029722, 0, 0}, - {204234270, 0, 0}, - {205885885, 0, 0}, - {244668133, 0, 0}, - {265778447, 0, 0}, - {753954113, 0, 0}, - {1000070091, 0, 0}, - {1671139745, 0, 0}, - {1774874546, 0, 0}, - {1776526161, 0, 0}, - {1887808856, 0, 0}, - {1889460471, 0, 0}, - {1917966999, 0, 0}, - {2044728014, 0, 0}, - {2192810893, 0, 0}, - {2293247016, 0, 0}, - {2503194620, 0, 0}, - {2608484640, 0, 0}, - {2615111110, 0, 0}, - {2668769415, 0, 0}, - {2759951687, 0, 0}, - {2761603302, 0, 0}, - {2856623532, 0, 0}, - {2956189845, 0, 0}, - {3085119011, 0, 0}, - {3367313400, 0, 0}, - {3447882276, 0, 0}, - {3633746133, 0, 0}, - {3635397748, 0, 0}, - {3710645347, 0, 0}, - {3712296962, 0, 0}, - {3727494858, 0, 0}, - {3747079365, 0, 0}, - {3748965853, 0, 0}, - {3750617468, 0, 0}, - {4018820793, 0, 0}, - {4022124023, 0, 0}, - {4024173916, 0, 0}, - {4215670524, 0, 0}, - {4217322139, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 39, 28}, - {0, 29, 40}, - {0, 37, 33}, - {0, 38, 12}, - {0, 9, 26}, - {0, 18, 6}, - {0, 41, 3}, - {0, 11, 13}, - {0, 5, 8}, - {0, 45, 30}, - {0, 22, 46}, - {0, 48, 47}, - {0, 16, 17}, - {0, 34, 49}, - {0, 51, 50}, - {0, 53, 52}, - {0, 7, 2}, - {0, 23, 21}, - {0, 54, 10}, - {0, 20, 36}, - {0, 55, 35}, - {0, 56, 4}, - {0, 43, 57}, - {0, 59, 58}, - {0, 60, 42}, - {0, 62, 61}, - {0, 63, 15}, - {0, 64, 31}, - {0, 14, 65}, - {0, 66, 24}, - {0, 67, 32}, - {0, 68, 19}, - {0, 70, 69}, - {0, 71, 27}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 78, 25}, - {0, 44, 79}, - {0, 81, 80}, - {0, 83, 82}, - {0, 1, 84}, - {0, 86, 85}, - })); - - codecs.emplace(std::pair(SpvOpFunction, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(41, { - {0, 0, 0}, - {436416061, 0, 0}, - {543621065, 0, 0}, - {679771963, 0, 0}, - {815757910, 0, 0}, - {827698488, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {1579585816, 0, 0}, - {1675764636, 0, 0}, - {1824016656, 0, 0}, - {1951208733, 0, 0}, - {2194691858, 0, 0}, - {2320303498, 0, 0}, - {2926633629, 0, 0}, - {3095831808, 0, 0}, - {3249265647, 0, 0}, - {3334207724, 0, 0}, - {4050155669, 0, 0}, - {4141567741, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 11}, - {0, 19, 16}, - {0, 9, 4}, - {0, 1, 17}, - {0, 22, 10}, - {0, 24, 23}, - {0, 15, 25}, - {0, 13, 26}, - {0, 27, 20}, - {0, 12, 28}, - {0, 30, 29}, - {0, 31, 18}, - {0, 3, 21}, - {0, 32, 14}, - {0, 34, 33}, - {0, 35, 8}, - {0, 5, 6}, - {0, 37, 36}, - {0, 39, 38}, - {0, 40, 7}, - })); - - codecs.emplace(std::pair(SpvOpFunctionParameter, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(41, { - {0, 0, 0}, - {522971108, 0, 0}, - {615341051, 0, 0}, - {718301639, 0, 0}, - {985750227, 0, 0}, - {1395113939, 0, 0}, - {1510333659, 0, 0}, - {1642805350, 0, 0}, - {1846856260, 0, 0}, - {1957218950, 0, 0}, - {1977038330, 0, 0}, - {1978689945, 0, 0}, - {1980341560, 0, 0}, - {2262220987, 0, 0}, - {2674422363, 0, 0}, - {3197739982, 0, 0}, - {3465954368, 0, 0}, - {3941049054, 0, 0}, - {3945795573, 0, 0}, - {4080527786, 0, 0}, - {4154758669, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 17}, - {0, 4, 15}, - {0, 8, 7}, - {0, 2, 20}, - {0, 22, 19}, - {0, 24, 23}, - {0, 14, 25}, - {0, 16, 26}, - {0, 27, 13}, - {0, 6, 28}, - {0, 30, 29}, - {0, 31, 10}, - {0, 11, 21}, - {0, 32, 12}, - {0, 34, 33}, - {0, 35, 5}, - {0, 9, 18}, - {0, 37, 36}, - {0, 39, 38}, - {0, 40, 1}, - })); - - codecs.emplace(std::pair(SpvOpFunctionParameter, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(27, { - {0, 0, 0}, - {545678922, 0, 0}, - {679771963, 0, 0}, - {899570100, 0, 0}, - {929101967, 0, 0}, - {1100599986, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3056042030, 0, 0}, - {3334207724, 0, 0}, - {3357250579, 0, 0}, - {3705139860, 0, 0}, - {3800912395, 0, 0}, - {3802564010, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 3}, - {0, 10, 13}, - {0, 4, 15}, - {0, 16, 11}, - {0, 17, 1}, - {0, 14, 12}, - {0, 19, 18}, - {0, 21, 20}, - {0, 22, 8}, - {0, 7, 6}, - {0, 23, 9}, - {0, 25, 24}, - {0, 26, 2}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(115, { - {0, 0, 0}, - {57149555, 0, 0}, - {86116519, 0, 0}, - {168339452, 0, 0}, - {181902171, 0, 0}, - {284226441, 0, 0}, - {314809953, 0, 0}, - {330249537, 0, 0}, - {527665290, 0, 0}, - {545363837, 0, 0}, - {707478563, 0, 0}, - {740921498, 0, 0}, - {807276090, 0, 0}, - {824323032, 0, 0}, - {835458563, 0, 0}, - {1162127370, 0, 0}, - {1245448751, 0, 0}, - {1277245109, 0, 0}, - {1375043498, 0, 0}, - {1380991098, 0, 0}, - {1603937321, 0, 0}, - {1708264968, 0, 0}, - {1717555224, 0, 0}, - {1765126703, 0, 0}, - {1838993983, 0, 0}, - {1949856502, 0, 0}, - {2108571893, 0, 0}, - {2110223508, 0, 0}, - {2293637521, 0, 0}, - {2377112119, 0, 0}, - {2378763734, 0, 0}, - {2512398201, 0, 0}, - {2516325050, 0, 0}, - {2645135839, 0, 0}, - {2708915136, 0, 0}, - {2894979602, 0, 0}, - {2903897222, 0, 0}, - {2976581453, 0, 0}, - {3054834317, 0, 0}, - {3075866530, 0, 0}, - {3085157904, 0, 0}, - {3242843022, 0, 0}, - {3266028549, 0, 0}, - {3296691317, 0, 0}, - {3299488628, 0, 0}, - {3322500634, 0, 0}, - {3345707173, 0, 0}, - {3536390697, 0, 0}, - {3584683259, 0, 0}, - {3647606635, 0, 0}, - {3760372982, 0, 0}, - {3823959661, 0, 0}, - {3839389658, 0, 0}, - {4124281183, 0, 0}, - {4130950286, 0, 0}, - {4169878842, 0, 0}, - {4174489262, 0, 0}, - {4237497041, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 17, 23}, - {0, 37, 8}, - {0, 45, 39}, - {0, 41, 14}, - {0, 48, 43}, - {0, 40, 31}, - {0, 19, 29}, - {0, 53, 26}, - {0, 10, 5}, - {0, 50, 24}, - {0, 27, 3}, - {0, 59, 32}, - {0, 51, 18}, - {0, 52, 55}, - {0, 60, 57}, - {0, 62, 61}, - {0, 36, 33}, - {0, 64, 63}, - {0, 65, 22}, - {0, 66, 46}, - {0, 6, 67}, - {0, 68, 13}, - {0, 21, 44}, - {0, 1, 69}, - {0, 30, 11}, - {0, 71, 70}, - {0, 12, 72}, - {0, 74, 73}, - {0, 76, 75}, - {0, 16, 2}, - {0, 49, 35}, - {0, 77, 9}, - {0, 42, 28}, - {0, 15, 78}, - {0, 80, 79}, - {0, 82, 81}, - {0, 47, 83}, - {0, 85, 84}, - {0, 87, 86}, - {0, 89, 88}, - {0, 20, 38}, - {0, 54, 90}, - {0, 34, 91}, - {0, 93, 92}, - {0, 25, 94}, - {0, 95, 7}, - {0, 97, 96}, - {0, 56, 98}, - {0, 100, 99}, - {0, 102, 101}, - {0, 104, 103}, - {0, 4, 105}, - {0, 107, 106}, - {0, 58, 108}, - {0, 110, 109}, - {0, 112, 111}, - {0, 114, 113}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(81, { - {0, 0, 0}, - {35240468, 0, 0}, - {36096192, 0, 0}, - {123060826, 0, 0}, - {184634770, 0, 0}, - {459968607, 0, 0}, - {619875033, 0, 0}, - {950731750, 0, 0}, - {1058429216, 0, 0}, - {1182296898, 0, 0}, - {1238120570, 0, 0}, - {1271484400, 0, 0}, - {1429389803, 0, 0}, - {1717510093, 0, 0}, - {1766422419, 0, 0}, - {1775308984, 0, 0}, - {1817271123, 0, 0}, - {1917336504, 0, 0}, - {1957265068, 0, 0}, - {1998433745, 0, 0}, - {2055664760, 0, 0}, - {2303184249, 0, 0}, - {2308565678, 0, 0}, - {2451531615, 0, 0}, - {2496297824, 0, 0}, - {2507457870, 0, 0}, - {2550501832, 0, 0}, - {2590402790, 0, 0}, - {2649103430, 0, 0}, - {2831059514, 0, 0}, - {2836440943, 0, 0}, - {3269075805, 0, 0}, - {3361419439, 0, 0}, - {3457269042, 0, 0}, - {3464197236, 0, 0}, - {3472029049, 0, 0}, - {3518630848, 0, 0}, - {3587381650, 0, 0}, - {3653985133, 0, 0}, - {4185590212, 0, 0}, - {4233562270, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 40, 37}, - {0, 22, 30}, - {0, 2, 7}, - {0, 24, 11}, - {0, 16, 33}, - {0, 6, 34}, - {0, 42, 27}, - {0, 5, 43}, - {0, 4, 44}, - {0, 36, 8}, - {0, 39, 45}, - {0, 46, 1}, - {0, 3, 47}, - {0, 48, 23}, - {0, 49, 9}, - {0, 50, 35}, - {0, 52, 51}, - {0, 32, 53}, - {0, 13, 10}, - {0, 26, 14}, - {0, 19, 54}, - {0, 55, 25}, - {0, 56, 38}, - {0, 17, 57}, - {0, 59, 58}, - {0, 61, 60}, - {0, 62, 29}, - {0, 12, 15}, - {0, 18, 63}, - {0, 28, 64}, - {0, 65, 31}, - {0, 67, 66}, - {0, 20, 41}, - {0, 69, 68}, - {0, 71, 70}, - {0, 21, 72}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - {0, 80, 79}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(61, { - {0, 0, 0}, - {37459569, 0, 0}, - {162167595, 0, 0}, - {535067202, 0, 0}, - {701281393, 0, 0}, - {837715723, 0, 0}, - {1320550031, 0, 0}, - {1630583316, 0, 0}, - {1913735398, 0, 0}, - {1918481917, 0, 0}, - {1955871800, 0, 0}, - {1977038330, 0, 0}, - {2053214130, 0, 0}, - {2443959748, 0, 0}, - {2564745684, 0, 0}, - {2622612602, 0, 0}, - {2677252364, 0, 0}, - {2736026107, 0, 0}, - {2790624748, 0, 0}, - {2882994691, 0, 0}, - {2888125966, 0, 0}, - {2970183398, 0, 0}, - {3253403867, 0, 0}, - {3427283542, 0, 0}, - {3570411982, 0, 0}, - {3619787319, 0, 0}, - {3662767579, 0, 0}, - {3884846406, 0, 0}, - {3910458990, 0, 0}, - {3927915220, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 20}, - {0, 6, 25}, - {0, 23, 3}, - {0, 2, 4}, - {0, 14, 17}, - {0, 11, 8}, - {0, 27, 10}, - {0, 19, 28}, - {0, 12, 16}, - {0, 33, 32}, - {0, 35, 34}, - {0, 37, 36}, - {0, 39, 38}, - {0, 40, 15}, - {0, 41, 7}, - {0, 1, 21}, - {0, 24, 13}, - {0, 29, 42}, - {0, 44, 43}, - {0, 22, 45}, - {0, 47, 46}, - {0, 49, 48}, - {0, 50, 30}, - {0, 31, 51}, - {0, 53, 52}, - {0, 55, 54}, - {0, 56, 9}, - {0, 57, 26}, - {0, 59, 58}, - {0, 60, 18}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(39, { - {0, 0, 0}, - {744062262, 0, 0}, - {810488476, 0, 0}, - {1040775722, 0, 0}, - {1280126114, 0, 0}, - {1367301635, 0, 0}, - {1684282922, 0, 0}, - {1918481917, 0, 0}, - {1978689945, 0, 0}, - {1980341560, 0, 0}, - {2443959748, 0, 0}, - {2629265310, 0, 0}, - {2790624748, 0, 0}, - {2970183398, 0, 0}, - {3044188332, 0, 0}, - {3496407048, 0, 0}, - {3662767579, 0, 0}, - {3887377256, 0, 0}, - {3971481069, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 2}, - {0, 18, 15}, - {0, 21, 6}, - {0, 13, 11}, - {0, 4, 22}, - {0, 14, 1}, - {0, 24, 23}, - {0, 25, 8}, - {0, 27, 26}, - {0, 20, 17}, - {0, 5, 28}, - {0, 29, 9}, - {0, 16, 10}, - {0, 31, 30}, - {0, 32, 7}, - {0, 19, 33}, - {0, 35, 34}, - {0, 37, 36}, - {0, 38, 12}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(27, { - {0, 0, 0}, - {37459569, 0, 0}, - {837715723, 0, 0}, - {1352628475, 0, 0}, - {1918481917, 0, 0}, - {1978689945, 0, 0}, - {1980341560, 0, 0}, - {2096388952, 0, 0}, - {2622612602, 0, 0}, - {2790624748, 0, 0}, - {2970183398, 0, 0}, - {3510682541, 0, 0}, - {3783543823, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 11}, - {0, 2, 8}, - {0, 15, 12}, - {0, 1, 3}, - {0, 16, 6}, - {0, 18, 17}, - {0, 19, 14}, - {0, 20, 5}, - {0, 10, 21}, - {0, 22, 4}, - {0, 23, 13}, - {0, 25, 24}, - {0, 9, 26}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {1510333659, 0, 0}, - {1684282922, 0, 0}, - {1918481917, 0, 0}, - {2790624748, 0, 0}, - {3662767579, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 1}, - {0, 8, 2}, - {0, 9, 7}, - {0, 3, 10}, - {0, 6, 11}, - {0, 4, 12}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(27, { - {0, 0, 0}, - {161668409, 0, 0}, - {188347929, 0, 0}, - {653708953, 0, 0}, - {976111724, 0, 0}, - {1510333659, 0, 0}, - {1918481917, 0, 0}, - {2790624748, 0, 0}, - {3033873113, 0, 0}, - {3499234137, 0, 0}, - {3525913657, 0, 0}, - {3552593177, 0, 0}, - {3570411982, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 3}, - {0, 2, 9}, - {0, 10, 11}, - {0, 15, 1}, - {0, 17, 16}, - {0, 19, 18}, - {0, 5, 4}, - {0, 20, 6}, - {0, 12, 21}, - {0, 14, 22}, - {0, 24, 23}, - {0, 7, 25}, - {0, 13, 26}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 7), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(31, { - {0, 0, 0}, - {226836633, 0, 0}, - {296981500, 0, 0}, - {718877177, 0, 0}, - {745556697, 0, 0}, - {798915737, 0, 0}, - {1510333659, 0, 0}, - {1684282922, 0, 0}, - {2444465148, 0, 0}, - {2713718873, 0, 0}, - {3495546641, 0, 0}, - {3564402361, 0, 0}, - {4056442905, 0, 0}, - {4083122425, 0, 0}, - {4123141705, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 14, 4}, - {0, 5, 3}, - {0, 9, 8}, - {0, 13, 12}, - {0, 1, 11}, - {0, 18, 17}, - {0, 2, 19}, - {0, 21, 20}, - {0, 23, 22}, - {0, 25, 24}, - {0, 26, 7}, - {0, 27, 16}, - {0, 10, 6}, - {0, 29, 28}, - {0, 15, 30}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 8), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(35, { - {0, 0, 0}, - {161668409, 0, 0}, - {188347929, 0, 0}, - {215027449, 0, 0}, - {296981500, 0, 0}, - {653708953, 0, 0}, - {680388473, 0, 0}, - {1119069977, 0, 0}, - {1510333659, 0, 0}, - {1584774136, 0, 0}, - {2049792025, 0, 0}, - {2444465148, 0, 0}, - {2568512089, 0, 0}, - {3033873113, 0, 0}, - {3499234137, 0, 0}, - {3525913657, 0, 0}, - {3552593177, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 6}, - {0, 10, 12}, - {0, 4, 3}, - {0, 16, 11}, - {0, 19, 14}, - {0, 5, 2}, - {0, 20, 13}, - {0, 21, 15}, - {0, 1, 22}, - {0, 24, 23}, - {0, 26, 25}, - {0, 28, 27}, - {0, 18, 29}, - {0, 8, 30}, - {0, 32, 31}, - {0, 9, 33}, - {0, 17, 34}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 9), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(25, { - {0, 0, 0}, - {825595257, 0, 0}, - {1064945649, 0, 0}, - {1290956281, 0, 0}, - {1510333659, 0, 0}, - {2096388952, 0, 0}, - {2248357849, 0, 0}, - {2713718873, 0, 0}, - {3187066832, 0, 0}, - {3205759417, 0, 0}, - {4064212479, 0, 0}, - {4163160985, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 3}, - {0, 2, 9}, - {0, 7, 6}, - {0, 5, 14}, - {0, 16, 15}, - {0, 17, 11}, - {0, 19, 18}, - {0, 20, 1}, - {0, 4, 13}, - {0, 22, 21}, - {0, 10, 23}, - {0, 12, 24}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 10), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(27, { - {0, 0, 0}, - {123108003, 0, 0}, - {296981500, 0, 0}, - {595410904, 0, 0}, - {1466938734, 0, 0}, - {1503477720, 0, 0}, - {1816558243, 0, 0}, - {1990431740, 0, 0}, - {2724625059, 0, 0}, - {2790624748, 0, 0}, - {2812498065, 0, 0}, - {3160388974, 0, 0}, - {3745223676, 0, 0}, - {3982311384, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 13}, - {0, 8, 1}, - {0, 12, 11}, - {0, 15, 3}, - {0, 6, 4}, - {0, 16, 7}, - {0, 17, 14}, - {0, 18, 2}, - {0, 19, 10}, - {0, 21, 20}, - {0, 23, 22}, - {0, 25, 24}, - {0, 9, 26}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 11), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(25, { - {0, 0, 0}, - {94145952, 0, 0}, - {1054641568, 0, 0}, - {1269075360, 0, 0}, - {1675922848, 0, 0}, - {2038205856, 0, 0}, - {2433519008, 0, 0}, - {2636942752, 0, 0}, - {2790624748, 0, 0}, - {2840366496, 0, 0}, - {2851900832, 0, 0}, - {2964622752, 0, 0}, - {3654061472, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 1}, - {0, 12, 6}, - {0, 14, 10}, - {0, 13, 4}, - {0, 11, 15}, - {0, 3, 16}, - {0, 2, 17}, - {0, 18, 5}, - {0, 9, 19}, - {0, 21, 20}, - {0, 23, 22}, - {0, 8, 24}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 12), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(45, { - {0, 0, 0}, - {107544081, 0, 0}, - {125015036, 0, 0}, - {586244865, 0, 0}, - {1033081852, 0, 0}, - {1064945649, 0, 0}, - {1155765244, 0, 0}, - {1304296041, 0, 0}, - {1543646433, 0, 0}, - {1782996825, 0, 0}, - {1941148668, 0, 0}, - {2002490364, 0, 0}, - {2022347217, 0, 0}, - {2063832060, 0, 0}, - {2487708241, 0, 0}, - {2726532092, 0, 0}, - {2849215484, 0, 0}, - {2966409025, 0, 0}, - {3445109809, 0, 0}, - {3458449569, 0, 0}, - {3634598908, 0, 0}, - {3695940604, 0, 0}, - {3923810593, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 2}, - {0, 14, 13}, - {0, 1, 23}, - {0, 6, 5}, - {0, 16, 15}, - {0, 24, 17}, - {0, 12, 25}, - {0, 22, 18}, - {0, 10, 26}, - {0, 28, 27}, - {0, 21, 29}, - {0, 31, 30}, - {0, 9, 8}, - {0, 11, 32}, - {0, 33, 19}, - {0, 3, 34}, - {0, 36, 35}, - {0, 38, 37}, - {0, 20, 39}, - {0, 41, 40}, - {0, 42, 4}, - {0, 44, 43}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 13), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(23, { - {0, 0, 0}, - {247698428, 0, 0}, - {309040124, 0, 0}, - {333554713, 0, 0}, - {572905105, 0, 0}, - {1033081852, 0, 0}, - {2002490364, 0, 0}, - {2009007457, 0, 0}, - {2487708241, 0, 0}, - {3634598908, 0, 0}, - {3695940604, 0, 0}, - {3923810593, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 1}, - {0, 9, 7}, - {0, 5, 12}, - {0, 14, 13}, - {0, 15, 8}, - {0, 3, 16}, - {0, 17, 11}, - {0, 10, 4}, - {0, 2, 18}, - {0, 20, 19}, - {0, 22, 21}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 14), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {247698428, 0, 0}, - {1033081852, 0, 0}, - {2002490364, 0, 0}, - {2910557180, 0, 0}, - {3757282300, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 4}, - {0, 7, 3}, - {0, 2, 8}, - {0, 1, 5}, - {0, 10, 9}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 15), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {1033081852, 0, 0}, - {1094423548, 0, 0}, - {2002490364, 0, 0}, - {3757282300, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 6, 2}, - {0, 4, 7}, - {0, 8, 1}, - })); - - codecs.emplace(std::pair(SpvOpFunctionCall, 16), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(57, { - {0, 0, 0}, - {135486769, 0, 0}, - {450406196, 0, 0}, - {503094540, 0, 0}, - {543621065, 0, 0}, - {827698488, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {1322549027, 0, 0}, - {1784441183, 0, 0}, - {2194691858, 0, 0}, - {2448331885, 0, 0}, - {2468230023, 0, 0}, - {2547657777, 0, 0}, - {2549309392, 0, 0}, - {2550961007, 0, 0}, - {2934934694, 0, 0}, - {2936586309, 0, 0}, - {2938237924, 0, 0}, - {3094180193, 0, 0}, - {3095831808, 0, 0}, - {3183924418, 0, 0}, - {3561562003, 0, 0}, - {3563213618, 0, 0}, - {3564865233, 0, 0}, - {4028622909, 0, 0}, - {4039938779, 0, 0}, - {4050155669, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 27, 28}, - {0, 10, 2}, - {0, 25, 24}, - {0, 1, 12}, - {0, 30, 3}, - {0, 20, 31}, - {0, 9, 32}, - {0, 34, 33}, - {0, 35, 22}, - {0, 26, 15}, - {0, 19, 36}, - {0, 18, 37}, - {0, 38, 16}, - {0, 39, 8}, - {0, 5, 40}, - {0, 6, 41}, - {0, 21, 42}, - {0, 11, 29}, - {0, 4, 43}, - {0, 13, 23}, - {0, 14, 17}, - {0, 7, 44}, - {0, 46, 45}, - {0, 48, 47}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 56, 55}, - })); - - codecs.emplace(std::pair(SpvOpVariable, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(57, { - {0, 0, 0}, - {37459569, 0, 0}, - {112745085, 0, 0}, - {137840602, 0, 0}, - {565334834, 0, 0}, - {625975427, 0, 0}, - {630964591, 0, 0}, - {680016782, 0, 0}, - {769422756, 0, 0}, - {1009983433, 0, 0}, - {1093210099, 0, 0}, - {1572088444, 0, 0}, - {1584774136, 0, 0}, - {1641565587, 0, 0}, - {1918481917, 0, 0}, - {2190437442, 0, 0}, - {2790624748, 0, 0}, - {3085467405, 0, 0}, - {3181646225, 0, 0}, - {3192069648, 0, 0}, - {3253403867, 0, 0}, - {3390051757, 0, 0}, - {3560665067, 0, 0}, - {3662767579, 0, 0}, - {4053789056, 0, 0}, - {4064212479, 0, 0}, - {4192247221, 0, 0}, - {4224872590, 0, 0}, - {4290024976, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 20}, - {0, 28, 10}, - {0, 13, 8}, - {0, 15, 17}, - {0, 30, 21}, - {0, 19, 31}, - {0, 4, 32}, - {0, 34, 33}, - {0, 35, 5}, - {0, 7, 24}, - {0, 9, 36}, - {0, 3, 37}, - {0, 38, 6}, - {0, 39, 23}, - {0, 27, 40}, - {0, 14, 41}, - {0, 25, 42}, - {0, 1, 29}, - {0, 12, 43}, - {0, 11, 26}, - {0, 18, 22}, - {0, 16, 44}, - {0, 46, 45}, - {0, 48, 47}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 56, 55}, - })); - - codecs.emplace(std::pair(SpvOpVariable, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(27, { - {0, 0, 0}, - {162255877, 0, 0}, - {679771963, 0, 0}, - {789872778, 0, 0}, - {1154919607, 0, 0}, - {1343794461, 0, 0}, - {1951208733, 0, 0}, - {2263349224, 0, 0}, - {2320303498, 0, 0}, - {2924146124, 0, 0}, - {2984325996, 0, 0}, - {3334207724, 0, 0}, - {3868239231, 0, 0}, - {3869890846, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 5, 3}, - {0, 9, 7}, - {0, 12, 4}, - {0, 16, 15}, - {0, 18, 17}, - {0, 14, 19}, - {0, 13, 10}, - {0, 20, 1}, - {0, 21, 8}, - {0, 2, 22}, - {0, 11, 23}, - {0, 6, 24}, - {0, 26, 25}, - })); - - codecs.emplace(std::pair(SpvOpLoad, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(83, { - {0, 0, 0}, - {169674806, 0, 0}, - {269823086, 0, 0}, - {408465899, 0, 0}, - {451264926, 0, 0}, - {543558236, 0, 0}, - {810488476, 0, 0}, - {850497536, 0, 0}, - {870594305, 0, 0}, - {883854656, 0, 0}, - {1033363654, 0, 0}, - {1069781886, 0, 0}, - {1141965917, 0, 0}, - {1323407757, 0, 0}, - {1570165302, 0, 0}, - {1684282922, 0, 0}, - {1742737136, 0, 0}, - {1901166356, 0, 0}, - {1949759310, 0, 0}, - {2043873558, 0, 0}, - {2087004702, 0, 0}, - {2096388952, 0, 0}, - {2157103435, 0, 0}, - {2219733501, 0, 0}, - {2356768706, 0, 0}, - {2443959748, 0, 0}, - {2517964682, 0, 0}, - {2614879967, 0, 0}, - {2622612602, 0, 0}, - {2660843182, 0, 0}, - {2959147533, 0, 0}, - {2970183398, 0, 0}, - {3044188332, 0, 0}, - {3091876332, 0, 0}, - {3187066832, 0, 0}, - {3244209297, 0, 0}, - {3487022798, 0, 0}, - {3496407048, 0, 0}, - {3570411982, 0, 0}, - {3692647551, 0, 0}, - {3713290482, 0, 0}, - {3831290364, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 1}, - {0, 35, 13}, - {0, 25, 11}, - {0, 7, 10}, - {0, 19, 36}, - {0, 43, 27}, - {0, 16, 29}, - {0, 22, 3}, - {0, 41, 30}, - {0, 44, 12}, - {0, 2, 24}, - {0, 40, 32}, - {0, 23, 45}, - {0, 46, 39}, - {0, 17, 33}, - {0, 48, 47}, - {0, 8, 49}, - {0, 51, 50}, - {0, 52, 20}, - {0, 53, 14}, - {0, 31, 54}, - {0, 15, 55}, - {0, 57, 56}, - {0, 59, 58}, - {0, 6, 26}, - {0, 61, 60}, - {0, 34, 62}, - {0, 64, 63}, - {0, 5, 37}, - {0, 9, 65}, - {0, 18, 28}, - {0, 66, 38}, - {0, 68, 67}, - {0, 69, 21}, - {0, 71, 70}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 79, 78}, - {0, 80, 42}, - {0, 82, 81}, - })); - - codecs.emplace(std::pair(SpvOpLoad, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(83, { - {0, 0, 0}, - {28782128, 0, 0}, - {30433743, 0, 0}, - {37459569, 0, 0}, - {137840602, 0, 0}, - {522971108, 0, 0}, - {565334834, 0, 0}, - {625975427, 0, 0}, - {630964591, 0, 0}, - {680016782, 0, 0}, - {1009983433, 0, 0}, - {1079999262, 0, 0}, - {1395113939, 0, 0}, - {1572088444, 0, 0}, - {1584774136, 0, 0}, - {1649426421, 0, 0}, - {1918481917, 0, 0}, - {1957218950, 0, 0}, - {2311941439, 0, 0}, - {2313593054, 0, 0}, - {2790624748, 0, 0}, - {2838165089, 0, 0}, - {2839816704, 0, 0}, - {2841468319, 0, 0}, - {3085467405, 0, 0}, - {3181646225, 0, 0}, - {3192069648, 0, 0}, - {3253403867, 0, 0}, - {3364388739, 0, 0}, - {3366040354, 0, 0}, - {3367691969, 0, 0}, - {3369343584, 0, 0}, - {3560665067, 0, 0}, - {3662767579, 0, 0}, - {3945795573, 0, 0}, - {4053789056, 0, 0}, - {4064212479, 0, 0}, - {4224872590, 0, 0}, - {4239834800, 0, 0}, - {4241486415, 0, 0}, - {4243138030, 0, 0}, - {4244789645, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 27}, - {0, 15, 2}, - {0, 10, 26}, - {0, 7, 24}, - {0, 9, 31}, - {0, 43, 30}, - {0, 29, 12}, - {0, 11, 41}, - {0, 40, 39}, - {0, 44, 23}, - {0, 22, 6}, - {0, 34, 35}, - {0, 18, 45}, - {0, 46, 21}, - {0, 17, 19}, - {0, 48, 47}, - {0, 28, 49}, - {0, 51, 50}, - {0, 52, 38}, - {0, 53, 33}, - {0, 4, 54}, - {0, 13, 55}, - {0, 57, 56}, - {0, 59, 58}, - {0, 37, 8}, - {0, 61, 60}, - {0, 5, 62}, - {0, 64, 63}, - {0, 36, 32}, - {0, 3, 65}, - {0, 14, 16}, - {0, 66, 25}, - {0, 68, 67}, - {0, 69, 20}, - {0, 71, 70}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 79, 78}, - {0, 80, 42}, - {0, 82, 81}, - })); - - codecs.emplace(std::pair(SpvOpLoad, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(49, { - {0, 0, 0}, - {137840602, 0, 0}, - {522971108, 0, 0}, - {769422756, 0, 0}, - {1009983433, 0, 0}, - {1079999262, 0, 0}, - {1558345254, 0, 0}, - {1572088444, 0, 0}, - {1641565587, 0, 0}, - {1918481917, 0, 0}, - {2311941439, 0, 0}, - {2313593054, 0, 0}, - {2790624748, 0, 0}, - {2838165089, 0, 0}, - {2994529201, 0, 0}, - {2996180816, 0, 0}, - {2997832431, 0, 0}, - {3027538652, 0, 0}, - {3253403867, 0, 0}, - {3364388739, 0, 0}, - {3560665067, 0, 0}, - {3662767579, 0, 0}, - {3945795573, 0, 0}, - {4192247221, 0, 0}, - {4224872590, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 14, 17}, - {0, 16, 15}, - {0, 13, 11}, - {0, 10, 3}, - {0, 22, 18}, - {0, 6, 8}, - {0, 19, 2}, - {0, 27, 26}, - {0, 28, 5}, - {0, 30, 29}, - {0, 32, 31}, - {0, 34, 33}, - {0, 4, 35}, - {0, 37, 36}, - {0, 21, 1}, - {0, 39, 38}, - {0, 40, 24}, - {0, 7, 23}, - {0, 20, 9}, - {0, 42, 41}, - {0, 43, 25}, - {0, 44, 12}, - {0, 46, 45}, - {0, 48, 47}, - })); - - codecs.emplace(std::pair(SpvOpStore, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(59, { - {0, 0, 0}, - {139011596, 0, 0}, - {177111659, 0, 0}, - {296981500, 0, 0}, - {408465899, 0, 0}, - {495107308, 0, 0}, - {810488476, 0, 0}, - {870594305, 0, 0}, - {1367301635, 0, 0}, - {1901166356, 0, 0}, - {2055836767, 0, 0}, - {2087004702, 0, 0}, - {2096388952, 0, 0}, - {2204920111, 0, 0}, - {2517964682, 0, 0}, - {2622612602, 0, 0}, - {2660843182, 0, 0}, - {2842919847, 0, 0}, - {2855506940, 0, 0}, - {2959147533, 0, 0}, - {3044188332, 0, 0}, - {3187066832, 0, 0}, - {3504158761, 0, 0}, - {3570411982, 0, 0}, - {3619787319, 0, 0}, - {3653838348, 0, 0}, - {3692647551, 0, 0}, - {3764205609, 0, 0}, - {3831290364, 0, 0}, - {3913885196, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 20, 29}, - {0, 25, 8}, - {0, 5, 1}, - {0, 24, 26}, - {0, 14, 9}, - {0, 27, 16}, - {0, 31, 7}, - {0, 33, 32}, - {0, 17, 34}, - {0, 35, 13}, - {0, 22, 6}, - {0, 3, 2}, - {0, 23, 36}, - {0, 28, 37}, - {0, 19, 4}, - {0, 38, 10}, - {0, 39, 15}, - {0, 40, 18}, - {0, 42, 41}, - {0, 43, 12}, - {0, 44, 21}, - {0, 45, 11}, - {0, 47, 46}, - {0, 49, 48}, - {0, 51, 50}, - {0, 53, 52}, - {0, 55, 54}, - {0, 57, 56}, - {0, 30, 58}, - })); - - codecs.emplace(std::pair(SpvOpStore, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(35, { - {0, 0, 0}, - {440421571, 0, 0}, - {827698488, 0, 0}, - {907126242, 0, 0}, - {908777857, 0, 0}, - {910429472, 0, 0}, - {1294403159, 0, 0}, - {1296054774, 0, 0}, - {1297706389, 0, 0}, - {2080953106, 0, 0}, - {2468230023, 0, 0}, - {2547657777, 0, 0}, - {2549309392, 0, 0}, - {2550961007, 0, 0}, - {3094857332, 0, 0}, - {3561562003, 0, 0}, - {3563213618, 0, 0}, - {3564865233, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 16, 12}, - {0, 17, 13}, - {0, 14, 19}, - {0, 18, 20}, - {0, 5, 21}, - {0, 11, 7}, - {0, 15, 22}, - {0, 9, 8}, - {0, 24, 23}, - {0, 25, 4}, - {0, 27, 26}, - {0, 28, 3}, - {0, 29, 10}, - {0, 6, 1}, - {0, 31, 30}, - {0, 32, 2}, - {0, 34, 33}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(99, { - {0, 0, 0}, - {27130513, 0, 0}, - {28782128, 0, 0}, - {30433743, 0, 0}, - {32085358, 0, 0}, - {155458798, 0, 0}, - {157110413, 0, 0}, - {163402553, 0, 0}, - {165054168, 0, 0}, - {213642219, 0, 0}, - {215293834, 0, 0}, - {216945449, 0, 0}, - {221900294, 0, 0}, - {545986953, 0, 0}, - {979993429, 0, 0}, - {1079999262, 0, 0}, - {1302400505, 0, 0}, - {1313182965, 0, 0}, - {1314834580, 0, 0}, - {1315613425, 0, 0}, - {1317265040, 0, 0}, - {1558345254, 0, 0}, - {1649426421, 0, 0}, - {2311941439, 0, 0}, - {2313593054, 0, 0}, - {2602027658, 0, 0}, - {2838165089, 0, 0}, - {2839816704, 0, 0}, - {2841468319, 0, 0}, - {2863084840, 0, 0}, - {2994529201, 0, 0}, - {2996180816, 0, 0}, - {2997832431, 0, 0}, - {3027538652, 0, 0}, - {3187387500, 0, 0}, - {3189039115, 0, 0}, - {3364388739, 0, 0}, - {3366040354, 0, 0}, - {3367691969, 0, 0}, - {3369343584, 0, 0}, - {3716914380, 0, 0}, - {3928842969, 0, 0}, - {3930494584, 0, 0}, - {3932146199, 0, 0}, - {3945482286, 0, 0}, - {4105051793, 0, 0}, - {4239834800, 0, 0}, - {4241486415, 0, 0}, - {4243138030, 0, 0}, - {4244789645, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 29, 10}, - {0, 17, 18}, - {0, 13, 14}, - {0, 44, 25}, - {0, 8, 7}, - {0, 20, 11}, - {0, 33, 19}, - {0, 6, 45}, - {0, 42, 43}, - {0, 40, 5}, - {0, 9, 16}, - {0, 1, 4}, - {0, 35, 34}, - {0, 12, 21}, - {0, 52, 51}, - {0, 31, 30}, - {0, 41, 32}, - {0, 54, 53}, - {0, 55, 2}, - {0, 3, 56}, - {0, 58, 57}, - {0, 60, 59}, - {0, 61, 22}, - {0, 63, 62}, - {0, 65, 64}, - {0, 67, 66}, - {0, 39, 68}, - {0, 38, 69}, - {0, 47, 70}, - {0, 49, 71}, - {0, 28, 48}, - {0, 37, 15}, - {0, 73, 72}, - {0, 74, 27}, - {0, 23, 75}, - {0, 76, 26}, - {0, 24, 77}, - {0, 79, 78}, - {0, 81, 80}, - {0, 82, 46}, - {0, 36, 83}, - {0, 85, 84}, - {0, 87, 86}, - {0, 89, 88}, - {0, 91, 90}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 50, 98}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(101, { - {0, 0, 0}, - {112745085, 0, 0}, - {116376005, 0, 0}, - {137840602, 0, 0}, - {400248103, 0, 0}, - {406044930, 0, 0}, - {468372467, 0, 0}, - {522971108, 0, 0}, - {615341051, 0, 0}, - {625975427, 0, 0}, - {630964591, 0, 0}, - {680016782, 0, 0}, - {763027711, 0, 0}, - {977312655, 0, 0}, - {1009983433, 0, 0}, - {1062250709, 0, 0}, - {1395113939, 0, 0}, - {1410849099, 0, 0}, - {1642805350, 0, 0}, - {1692932387, 0, 0}, - {1698730948, 0, 0}, - {1827244161, 0, 0}, - {1918481917, 0, 0}, - {2096472894, 0, 0}, - {2190437442, 0, 0}, - {2299842241, 0, 0}, - {2433358586, 0, 0}, - {2593325766, 0, 0}, - {2785441472, 0, 0}, - {2790624748, 0, 0}, - {2879917723, 0, 0}, - {2882994691, 0, 0}, - {2902069960, 0, 0}, - {3090408469, 0, 0}, - {3181646225, 0, 0}, - {3255947500, 0, 0}, - {3263901372, 0, 0}, - {3268751013, 0, 0}, - {3347863687, 0, 0}, - {3390051757, 0, 0}, - {3560665067, 0, 0}, - {3617689692, 0, 0}, - {3662767579, 0, 0}, - {3717523241, 0, 0}, - {3854557817, 0, 0}, - {3910458990, 0, 0}, - {3941049054, 0, 0}, - {3945795573, 0, 0}, - {4080527786, 0, 0}, - {4101009465, 0, 0}, - {4290024976, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 32, 44}, - {0, 41, 26}, - {0, 16, 10}, - {0, 27, 45}, - {0, 25, 38}, - {0, 12, 18}, - {0, 6, 35}, - {0, 46, 23}, - {0, 20, 37}, - {0, 52, 19}, - {0, 53, 21}, - {0, 54, 48}, - {0, 33, 55}, - {0, 3, 8}, - {0, 28, 56}, - {0, 13, 57}, - {0, 59, 58}, - {0, 1, 49}, - {0, 47, 60}, - {0, 61, 14}, - {0, 63, 62}, - {0, 64, 43}, - {0, 7, 4}, - {0, 65, 15}, - {0, 67, 66}, - {0, 68, 17}, - {0, 36, 2}, - {0, 30, 69}, - {0, 71, 70}, - {0, 34, 5}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 24, 78}, - {0, 39, 31}, - {0, 80, 79}, - {0, 9, 11}, - {0, 42, 81}, - {0, 83, 82}, - {0, 29, 50}, - {0, 84, 51}, - {0, 86, 85}, - {0, 22, 40}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - {0, 96, 95}, - {0, 98, 97}, - {0, 100, 99}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(69, { - {0, 0, 0}, - {51041423, 0, 0}, - {142465290, 0, 0}, - {144116905, 0, 0}, - {290391815, 0, 0}, - {438318340, 0, 0}, - {529742207, 0, 0}, - {677668732, 0, 0}, - {917019124, 0, 0}, - {1064945649, 0, 0}, - {1156369516, 0, 0}, - {1158021131, 0, 0}, - {1304296041, 0, 0}, - {1452222566, 0, 0}, - {1543646433, 0, 0}, - {1691572958, 0, 0}, - {1782996825, 0, 0}, - {1784648440, 0, 0}, - {1930923350, 0, 0}, - {2170273742, 0, 0}, - {2318200267, 0, 0}, - {2466126792, 0, 0}, - {2557550659, 0, 0}, - {2705477184, 0, 0}, - {2796901051, 0, 0}, - {2798552666, 0, 0}, - {2944827576, 0, 0}, - {3092754101, 0, 0}, - {3184177968, 0, 0}, - {3332104493, 0, 0}, - {3571454885, 0, 0}, - {3810805277, 0, 0}, - {3958731802, 0, 0}, - {4106658327, 0, 0}, - {4198082194, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 27, 33}, - {0, 21, 5}, - {0, 26, 13}, - {0, 20, 8}, - {0, 15, 7}, - {0, 37, 36}, - {0, 32, 29}, - {0, 38, 4}, - {0, 30, 1}, - {0, 9, 12}, - {0, 39, 18}, - {0, 22, 40}, - {0, 42, 41}, - {0, 44, 43}, - {0, 45, 35}, - {0, 46, 34}, - {0, 6, 14}, - {0, 28, 23}, - {0, 48, 47}, - {0, 49, 31}, - {0, 51, 50}, - {0, 19, 24}, - {0, 52, 10}, - {0, 2, 53}, - {0, 55, 54}, - {0, 25, 56}, - {0, 11, 57}, - {0, 59, 58}, - {0, 3, 17}, - {0, 61, 60}, - {0, 16, 62}, - {0, 64, 63}, - {0, 66, 65}, - {0, 68, 67}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(85, { - {0, 0, 0}, - {142465290, 0, 0}, - {144116905, 0, 0}, - {198967948, 0, 0}, - {290391815, 0, 0}, - {529742207, 0, 0}, - {586244865, 0, 0}, - {677668732, 0, 0}, - {825595257, 0, 0}, - {917019124, 0, 0}, - {973521782, 0, 0}, - {1064945649, 0, 0}, - {1156369516, 0, 0}, - {1158021131, 0, 0}, - {1212872174, 0, 0}, - {1304296041, 0, 0}, - {1452222566, 0, 0}, - {1543646433, 0, 0}, - {1600149091, 0, 0}, - {1782996825, 0, 0}, - {1784648440, 0, 0}, - {1839499483, 0, 0}, - {1930923350, 0, 0}, - {2170273742, 0, 0}, - {2226776400, 0, 0}, - {2318200267, 0, 0}, - {2466126792, 0, 0}, - {2557550659, 0, 0}, - {2614053317, 0, 0}, - {2796901051, 0, 0}, - {2798552666, 0, 0}, - {2853403709, 0, 0}, - {2944827576, 0, 0}, - {3184177968, 0, 0}, - {3240680626, 0, 0}, - {3480031018, 0, 0}, - {3571454885, 0, 0}, - {3810805277, 0, 0}, - {3867307935, 0, 0}, - {3958731802, 0, 0}, - {4106658327, 0, 0}, - {4198082194, 0, 0}, - {4254584852, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 7, 11}, - {0, 15, 4}, - {0, 32, 25}, - {0, 44, 39}, - {0, 36, 22}, - {0, 45, 17}, - {0, 24, 46}, - {0, 10, 9}, - {0, 6, 27}, - {0, 28, 18}, - {0, 42, 34}, - {0, 31, 14}, - {0, 41, 38}, - {0, 26, 3}, - {0, 47, 33}, - {0, 21, 8}, - {0, 5, 35}, - {0, 40, 16}, - {0, 37, 23}, - {0, 49, 48}, - {0, 51, 50}, - {0, 53, 52}, - {0, 55, 54}, - {0, 57, 56}, - {0, 59, 58}, - {0, 61, 60}, - {0, 63, 62}, - {0, 65, 64}, - {0, 67, 66}, - {0, 68, 12}, - {0, 29, 69}, - {0, 70, 1}, - {0, 30, 2}, - {0, 43, 71}, - {0, 73, 72}, - {0, 74, 20}, - {0, 75, 19}, - {0, 77, 76}, - {0, 13, 78}, - {0, 80, 79}, - {0, 82, 81}, - {0, 84, 83}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {144116905, 0, 0}, - {1158021131, 0, 0}, - {1784648440, 0, 0}, - {2798552666, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 5}, - {0, 4, 2}, - {0, 6, 3}, - {0, 8, 7}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(5, { - {0, 0, 0}, - {142465290, 0, 0}, - {1782996825, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 1}, - {0, 4, 3}, - })); - - codecs.emplace(std::pair(SpvOpAccessChain, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 2, 5}, - {0, 6, 1}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(59, { - {0, 0, 0}, - {177111659, 0, 0}, - {413918748, 0, 0}, - {529383565, 0, 0}, - {646282397, 0, 0}, - {837715723, 0, 0}, - {1019457583, 0, 0}, - {1022544883, 0, 0}, - {1054461787, 0, 0}, - {1097775533, 0, 0}, - {1136775085, 0, 0}, - {1191015885, 0, 0}, - {1196280518, 0, 0}, - {1203545131, 0, 0}, - {1352628475, 0, 0}, - {1367301635, 0, 0}, - {1918742169, 0, 0}, - {1922045399, 0, 0}, - {2055836767, 0, 0}, - {2183547611, 0, 0}, - {2204920111, 0, 0}, - {2358141757, 0, 0}, - {2572638469, 0, 0}, - {2597020383, 0, 0}, - {2842919847, 0, 0}, - {3619787319, 0, 0}, - {3701632935, 0, 0}, - {3783543823, 0, 0}, - {4245257809, 0, 0}, - {4265894873, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 11, 23}, - {0, 12, 2}, - {0, 9, 7}, - {0, 21, 19}, - {0, 4, 29}, - {0, 10, 28}, - {0, 17, 16}, - {0, 27, 3}, - {0, 32, 31}, - {0, 33, 22}, - {0, 6, 34}, - {0, 35, 8}, - {0, 36, 24}, - {0, 38, 37}, - {0, 1, 14}, - {0, 39, 20}, - {0, 5, 40}, - {0, 42, 41}, - {0, 43, 26}, - {0, 45, 44}, - {0, 47, 46}, - {0, 48, 18}, - {0, 15, 49}, - {0, 50, 25}, - {0, 51, 13}, - {0, 53, 52}, - {0, 55, 54}, - {0, 57, 56}, - {0, 30, 58}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(59, { - {0, 0, 0}, - {236660303, 0, 0}, - {342159236, 0, 0}, - {371428004, 0, 0}, - {373079619, 0, 0}, - {488500848, 0, 0}, - {495107308, 0, 0}, - {864295921, 0, 0}, - {1071164424, 0, 0}, - {1136911283, 0, 0}, - {1178317551, 0, 0}, - {1510422521, 0, 0}, - {1570165302, 0, 0}, - {1822823090, 0, 0}, - {1858116930, 0, 0}, - {1977038330, 0, 0}, - {2096388952, 0, 0}, - {2157103435, 0, 0}, - {2231688008, 0, 0}, - {2604576561, 0, 0}, - {2622612602, 0, 0}, - {2771938750, 0, 0}, - {2777172031, 0, 0}, - {2996594997, 0, 0}, - {3187066832, 0, 0}, - {3496407048, 0, 0}, - {3570411982, 0, 0}, - {3609540589, 0, 0}, - {3713290482, 0, 0}, - {3797761273, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 18, 8}, - {0, 27, 9}, - {0, 21, 10}, - {0, 14, 24}, - {0, 12, 19}, - {0, 11, 15}, - {0, 23, 2}, - {0, 7, 13}, - {0, 31, 22}, - {0, 32, 4}, - {0, 33, 29}, - {0, 34, 1}, - {0, 35, 3}, - {0, 37, 36}, - {0, 38, 28}, - {0, 39, 5}, - {0, 41, 40}, - {0, 42, 17}, - {0, 16, 43}, - {0, 45, 44}, - {0, 46, 6}, - {0, 48, 47}, - {0, 50, 49}, - {0, 52, 51}, - {0, 25, 53}, - {0, 54, 20}, - {0, 55, 26}, - {0, 57, 56}, - {0, 30, 58}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(47, { - {0, 0, 0}, - {236660303, 0, 0}, - {342159236, 0, 0}, - {488500848, 0, 0}, - {495107308, 0, 0}, - {864295921, 0, 0}, - {1178317551, 0, 0}, - {1510422521, 0, 0}, - {1570165302, 0, 0}, - {1858116930, 0, 0}, - {1977038330, 0, 0}, - {2096388952, 0, 0}, - {2157103435, 0, 0}, - {2231688008, 0, 0}, - {2604576561, 0, 0}, - {2622612602, 0, 0}, - {2771938750, 0, 0}, - {2777172031, 0, 0}, - {2996594997, 0, 0}, - {3496407048, 0, 0}, - {3570411982, 0, 0}, - {3609540589, 0, 0}, - {3713290482, 0, 0}, - {3797761273, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 21, 13}, - {0, 16, 6}, - {0, 14, 9}, - {0, 7, 10}, - {0, 18, 2}, - {0, 17, 5}, - {0, 25, 8}, - {0, 22, 12}, - {0, 26, 23}, - {0, 27, 1}, - {0, 28, 3}, - {0, 30, 29}, - {0, 32, 31}, - {0, 34, 33}, - {0, 35, 11}, - {0, 36, 4}, - {0, 38, 37}, - {0, 40, 39}, - {0, 41, 15}, - {0, 42, 19}, - {0, 20, 43}, - {0, 45, 44}, - {0, 24, 46}, - })); - - codecs.emplace(std::pair(SpvOpVectorShuffle, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {679771963, 0, 0}, - {1146476634, 0, 0}, - {2160380860, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {3800912395, 0, 0}, - {3802564010, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 3}, - {0, 9, 6}, - {0, 8, 7}, - {0, 11, 10}, - {0, 4, 12}, - {0, 5, 13}, - {0, 14, 1}, - })); - - codecs.emplace(std::pair(SpvOpCompositeConstruct, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(79, { - {0, 0, 0}, - {107497541, 0, 0}, - {289648234, 0, 0}, - {348584153, 0, 0}, - {369686787, 0, 0}, - {429277936, 0, 0}, - {449954059, 0, 0}, - {508217552, 0, 0}, - {742917749, 0, 0}, - {1032593647, 0, 0}, - {1158929937, 0, 0}, - {1209418480, 0, 0}, - {1319785741, 0, 0}, - {1321616112, 0, 0}, - {1417363940, 0, 0}, - {1541020250, 0, 0}, - {1564342316, 0, 0}, - {1578775276, 0, 0}, - {1631434666, 0, 0}, - {1636389511, 0, 0}, - {2012838864, 0, 0}, - {2262137600, 0, 0}, - {2281956980, 0, 0}, - {2359973133, 0, 0}, - {2464905186, 0, 0}, - {2613179511, 0, 0}, - {2621255555, 0, 0}, - {2817335337, 0, 0}, - {2881302403, 0, 0}, - {3063300848, 0, 0}, - {3151638847, 0, 0}, - {3233393284, 0, 0}, - {3323682385, 0, 0}, - {3337532056, 0, 0}, - {3456899824, 0, 0}, - {3547456240, 0, 0}, - {3675926744, 0, 0}, - {3753486980, 0, 0}, - {3931641900, 0, 0}, - {3970432934, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 25, 1}, - {0, 6, 4}, - {0, 8, 19}, - {0, 39, 24}, - {0, 3, 2}, - {0, 34, 14}, - {0, 10, 9}, - {0, 18, 38}, - {0, 32, 15}, - {0, 27, 16}, - {0, 28, 35}, - {0, 13, 26}, - {0, 20, 23}, - {0, 21, 11}, - {0, 36, 33}, - {0, 5, 22}, - {0, 42, 41}, - {0, 43, 29}, - {0, 45, 44}, - {0, 7, 46}, - {0, 48, 47}, - {0, 30, 31}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 55, 17}, - {0, 57, 56}, - {0, 59, 58}, - {0, 61, 60}, - {0, 62, 12}, - {0, 64, 63}, - {0, 66, 65}, - {0, 67, 37}, - {0, 69, 68}, - {0, 71, 70}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 40, 78}, - })); - - codecs.emplace(std::pair(SpvOpCompositeConstruct, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(87, { - {0, 0, 0}, - {153013225, 0, 0}, - {296836635, 0, 0}, - {296981500, 0, 0}, - {778500192, 0, 0}, - {810488476, 0, 0}, - {848380423, 0, 0}, - {900522183, 0, 0}, - {910398460, 0, 0}, - {959681532, 0, 0}, - {1141965917, 0, 0}, - {1287304304, 0, 0}, - {1323407757, 0, 0}, - {1417363940, 0, 0}, - {1471851763, 0, 0}, - {1526654696, 0, 0}, - {1654776395, 0, 0}, - {1684282922, 0, 0}, - {1739837626, 0, 0}, - {1791352211, 0, 0}, - {2195550588, 0, 0}, - {2319227476, 0, 0}, - {2491124112, 0, 0}, - {2789375411, 0, 0}, - {2807448986, 0, 0}, - {2817579280, 0, 0}, - {2835131395, 0, 0}, - {2847102741, 0, 0}, - {2855506940, 0, 0}, - {2860348412, 0, 0}, - {3079287749, 0, 0}, - {3091876332, 0, 0}, - {3168953855, 0, 0}, - {3374978006, 0, 0}, - {3399062057, 0, 0}, - {3510257966, 0, 0}, - {3554463148, 0, 0}, - {3579593979, 0, 0}, - {3757851979, 0, 0}, - {3759503594, 0, 0}, - {3761155209, 0, 0}, - {3762806824, 0, 0}, - {3902853271, 0, 0}, - {4140081844, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 38, 42}, - {0, 14, 23}, - {0, 26, 18}, - {0, 39, 35}, - {0, 6, 40}, - {0, 16, 13}, - {0, 33, 34}, - {0, 12, 4}, - {0, 27, 41}, - {0, 25, 21}, - {0, 24, 1}, - {0, 37, 19}, - {0, 32, 22}, - {0, 2, 8}, - {0, 20, 17}, - {0, 43, 36}, - {0, 29, 15}, - {0, 46, 45}, - {0, 48, 47}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 7, 55}, - {0, 56, 30}, - {0, 57, 5}, - {0, 59, 58}, - {0, 60, 11}, - {0, 9, 61}, - {0, 63, 62}, - {0, 65, 64}, - {0, 66, 31}, - {0, 68, 67}, - {0, 10, 69}, - {0, 71, 70}, - {0, 28, 72}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - {0, 79, 3}, - {0, 81, 80}, - {0, 83, 82}, - {0, 85, 84}, - {0, 44, 86}, - })); - - codecs.emplace(std::pair(SpvOpCompositeConstruct, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(81, { - {0, 0, 0}, - {14244860, 0, 0}, - {150820676, 0, 0}, - {153013225, 0, 0}, - {269823086, 0, 0}, - {289648234, 0, 0}, - {296981500, 0, 0}, - {678695941, 0, 0}, - {810488476, 0, 0}, - {850592577, 0, 0}, - {870594305, 0, 0}, - {910398460, 0, 0}, - {959681532, 0, 0}, - {1206571206, 0, 0}, - {1287304304, 0, 0}, - {1323407757, 0, 0}, - {1471851763, 0, 0}, - {1526654696, 0, 0}, - {1684282922, 0, 0}, - {1734446471, 0, 0}, - {1758530522, 0, 0}, - {2117320444, 0, 0}, - {2118972059, 0, 0}, - {2120623674, 0, 0}, - {2122275289, 0, 0}, - {2219733501, 0, 0}, - {2262321736, 0, 0}, - {2807448986, 0, 0}, - {2817579280, 0, 0}, - {2835131395, 0, 0}, - {2855506940, 0, 0}, - {2860348412, 0, 0}, - {2951272396, 0, 0}, - {3079287749, 0, 0}, - {3168953855, 0, 0}, - {3502816184, 0, 0}, - {3510257966, 0, 0}, - {3554463148, 0, 0}, - {3997952447, 0, 0}, - {4140081844, 0, 0}, - {4182141402, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 21, 26}, - {0, 29, 16}, - {0, 22, 36}, - {0, 1, 23}, - {0, 20, 5}, - {0, 19, 35}, - {0, 10, 38}, - {0, 13, 24}, - {0, 28, 7}, - {0, 27, 3}, - {0, 40, 2}, - {0, 34, 9}, - {0, 32, 11}, - {0, 33, 18}, - {0, 39, 37}, - {0, 31, 17}, - {0, 43, 42}, - {0, 45, 44}, - {0, 47, 46}, - {0, 49, 48}, - {0, 51, 50}, - {0, 8, 52}, - {0, 15, 53}, - {0, 55, 54}, - {0, 56, 14}, - {0, 58, 57}, - {0, 60, 59}, - {0, 61, 25}, - {0, 63, 62}, - {0, 4, 64}, - {0, 66, 65}, - {0, 68, 67}, - {0, 70, 69}, - {0, 71, 12}, - {0, 6, 72}, - {0, 30, 73}, - {0, 75, 74}, - {0, 77, 76}, - {0, 79, 78}, - {0, 41, 80}, - })); - - codecs.emplace(std::pair(SpvOpCompositeConstruct, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(111, { - {0, 0, 0}, - {34183582, 0, 0}, - {93914936, 0, 0}, - {94303122, 0, 0}, - {117998987, 0, 0}, - {153013225, 0, 0}, - {296981500, 0, 0}, - {451264926, 0, 0}, - {473485679, 0, 0}, - {476788909, 0, 0}, - {478440524, 0, 0}, - {480092139, 0, 0}, - {481743754, 0, 0}, - {810488476, 0, 0}, - {871966503, 0, 0}, - {910398460, 0, 0}, - {918189168, 0, 0}, - {933769938, 0, 0}, - {959681532, 0, 0}, - {1149665466, 0, 0}, - {1166917451, 0, 0}, - {1227221002, 0, 0}, - {1310740861, 0, 0}, - {1323407757, 0, 0}, - {1341516288, 0, 0}, - {1373166395, 0, 0}, - {1445161581, 0, 0}, - {1461645203, 0, 0}, - {1471851763, 0, 0}, - {1526654696, 0, 0}, - {1561718045, 0, 0}, - {1593584949, 0, 0}, - {1684282922, 0, 0}, - {1800404122, 0, 0}, - {1862284649, 0, 0}, - {2213411495, 0, 0}, - {2668680621, 0, 0}, - {2805256437, 0, 0}, - {2807448986, 0, 0}, - {2835131395, 0, 0}, - {2855506940, 0, 0}, - {2860348412, 0, 0}, - {3000904950, 0, 0}, - {3107413701, 0, 0}, - {3168953855, 0, 0}, - {3333131702, 0, 0}, - {3365041621, 0, 0}, - {3456899824, 0, 0}, - {3505028338, 0, 0}, - {3510257966, 0, 0}, - {3554463148, 0, 0}, - {3606320646, 0, 0}, - {3692647551, 0, 0}, - {3861006967, 0, 0}, - {4126287524, 0, 0}, - {4140081844, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 14, 33}, - {0, 35, 25}, - {0, 27, 17}, - {0, 8, 20}, - {0, 3, 54}, - {0, 1, 19}, - {0, 10, 46}, - {0, 11, 9}, - {0, 39, 28}, - {0, 53, 49}, - {0, 12, 2}, - {0, 34, 4}, - {0, 47, 36}, - {0, 23, 45}, - {0, 5, 37}, - {0, 24, 38}, - {0, 43, 26}, - {0, 48, 51}, - {0, 44, 32}, - {0, 15, 16}, - {0, 57, 22}, - {0, 55, 50}, - {0, 29, 58}, - {0, 60, 59}, - {0, 41, 61}, - {0, 63, 62}, - {0, 65, 64}, - {0, 67, 66}, - {0, 69, 68}, - {0, 13, 70}, - {0, 71, 7}, - {0, 42, 31}, - {0, 73, 72}, - {0, 75, 74}, - {0, 21, 30}, - {0, 77, 76}, - {0, 79, 78}, - {0, 81, 80}, - {0, 82, 18}, - {0, 84, 83}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 52, 91}, - {0, 6, 92}, - {0, 94, 93}, - {0, 96, 95}, - {0, 98, 97}, - {0, 99, 40}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 56, 110}, - })); - - codecs.emplace(std::pair(SpvOpCompositeConstruct, 4), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(155, { - {0, 0, 0}, - {18776483, 0, 0}, - {37009196, 0, 0}, - {277023757, 0, 0}, - {296981500, 0, 0}, - {348988933, 0, 0}, - {451264926, 0, 0}, - {564884461, 0, 0}, - {804899022, 0, 0}, - {810488476, 0, 0}, - {870594305, 0, 0}, - {876864198, 0, 0}, - {900522183, 0, 0}, - {928261291, 0, 0}, - {959681532, 0, 0}, - {1164724902, 0, 0}, - {1323407757, 0, 0}, - {1332774287, 0, 0}, - {1404739463, 0, 0}, - {1447712361, 0, 0}, - {1450415100, 0, 0}, - {1513770932, 0, 0}, - {1620634991, 0, 0}, - {1692600167, 0, 0}, - {1860649552, 0, 0}, - {1932614728, 0, 0}, - {2087004702, 0, 0}, - {2148510256, 0, 0}, - {2220475432, 0, 0}, - {2388524817, 0, 0}, - {2460489993, 0, 0}, - {2676385521, 0, 0}, - {2748350697, 0, 0}, - {2855506940, 0, 0}, - {2860348412, 0, 0}, - {2916400082, 0, 0}, - {2988365258, 0, 0}, - {3061856840, 0, 0}, - {3063508455, 0, 0}, - {3065160070, 0, 0}, - {3066811685, 0, 0}, - {3068463300, 0, 0}, - {3070114915, 0, 0}, - {3071766530, 0, 0}, - {3073418145, 0, 0}, - {3075069760, 0, 0}, - {3076721375, 0, 0}, - {3078372990, 0, 0}, - {3080024605, 0, 0}, - {3081676220, 0, 0}, - {3083327835, 0, 0}, - {3084979450, 0, 0}, - {3086631065, 0, 0}, - {3088282680, 0, 0}, - {3114708520, 0, 0}, - {3116360135, 0, 0}, - {3118011750, 0, 0}, - {3119663365, 0, 0}, - {3121314980, 0, 0}, - {3124618210, 0, 0}, - {3126269825, 0, 0}, - {3127921440, 0, 0}, - {3129573055, 0, 0}, - {3131224670, 0, 0}, - {3132876285, 0, 0}, - {3134527900, 0, 0}, - {3136179515, 0, 0}, - {3204260786, 0, 0}, - {3264086791, 0, 0}, - {3276225962, 0, 0}, - {3444275347, 0, 0}, - {3516240523, 0, 0}, - {3588205699, 0, 0}, - {3732136051, 0, 0}, - {3804101227, 0, 0}, - {3874089391, 0, 0}, - {4044115788, 0, 0}, - {4116080964, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 45, 43}, - {0, 3, 46}, - {0, 71, 36}, - {0, 44, 34}, - {0, 76, 54}, - {0, 73, 55}, - {0, 57, 67}, - {0, 51, 56}, - {0, 31, 27}, - {0, 38, 37}, - {0, 40, 39}, - {0, 42, 41}, - {0, 49, 47}, - {0, 35, 50}, - {0, 21, 70}, - {0, 19, 5}, - {0, 8, 58}, - {0, 17, 11}, - {0, 24, 18}, - {0, 30, 29}, - {0, 52, 9}, - {0, 77, 22}, - {0, 62, 48}, - {0, 25, 53}, - {0, 20, 59}, - {0, 26, 60}, - {0, 72, 6}, - {0, 79, 69}, - {0, 80, 7}, - {0, 81, 2}, - {0, 12, 13}, - {0, 82, 68}, - {0, 65, 61}, - {0, 74, 63}, - {0, 23, 83}, - {0, 64, 10}, - {0, 84, 32}, - {0, 66, 28}, - {0, 15, 85}, - {0, 86, 16}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 1, 93}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 100, 75}, - {0, 102, 101}, - {0, 104, 103}, - {0, 106, 105}, - {0, 107, 14}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 127, 126}, - {0, 129, 128}, - {0, 131, 130}, - {0, 133, 132}, - {0, 135, 134}, - {0, 137, 136}, - {0, 139, 138}, - {0, 141, 140}, - {0, 143, 142}, - {0, 145, 144}, - {0, 147, 146}, - {0, 33, 148}, - {0, 4, 149}, - {0, 78, 150}, - {0, 152, 151}, - {0, 154, 153}, - })); - - codecs.emplace(std::pair(SpvOpCompositeConstruct, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {679771963, 0, 0}, - {789872778, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 2}, - {0, 4, 7}, - {0, 1, 8}, - {0, 9, 5}, - {0, 3, 10}, - })); - - codecs.emplace(std::pair(SpvOpCompositeExtract, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(49, { - {0, 0, 0}, - {126463145, 0, 0}, - {171307615, 0, 0}, - {342159236, 0, 0}, - {354479447, 0, 0}, - {593829839, 0, 0}, - {743407979, 0, 0}, - {898191441, 0, 0}, - {900522183, 0, 0}, - {1265796414, 0, 0}, - {1287304304, 0, 0}, - {1356063462, 0, 0}, - {1368383673, 0, 0}, - {1526654696, 0, 0}, - {1766994680, 0, 0}, - {1793544760, 0, 0}, - {1811839150, 0, 0}, - {2234361374, 0, 0}, - {2279700640, 0, 0}, - {2383939514, 0, 0}, - {2780898906, 0, 0}, - {2996594997, 0, 0}, - {3413713311, 0, 0}, - {3554463148, 0, 0}, - {3635542517, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 11, 15}, - {0, 20, 14}, - {0, 7, 18}, - {0, 6, 1}, - {0, 12, 10}, - {0, 23, 19}, - {0, 13, 5}, - {0, 24, 17}, - {0, 21, 3}, - {0, 22, 16}, - {0, 26, 2}, - {0, 27, 8}, - {0, 4, 28}, - {0, 29, 9}, - {0, 31, 30}, - {0, 33, 32}, - {0, 35, 34}, - {0, 37, 36}, - {0, 39, 38}, - {0, 41, 40}, - {0, 43, 42}, - {0, 45, 44}, - {0, 47, 46}, - {0, 25, 48}, - })); - - codecs.emplace(std::pair(SpvOpCompositeExtract, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(153, { - {0, 0, 0}, - {13107491, 0, 0}, - {257136089, 0, 0}, - {293528591, 0, 0}, - {321459212, 0, 0}, - {425022309, 0, 0}, - {490769168, 0, 0}, - {495107308, 0, 0}, - {517919178, 0, 0}, - {617312262, 0, 0}, - {708736129, 0, 0}, - {753756604, 0, 0}, - {765238787, 0, 0}, - {796985462, 0, 0}, - {819503463, 0, 0}, - {850497536, 0, 0}, - {948086521, 0, 0}, - {1004589179, 0, 0}, - {1120149824, 0, 0}, - {1165671422, 0, 0}, - {1203545131, 0, 0}, - {1297165140, 0, 0}, - {1335363438, 0, 0}, - {1351676723, 0, 0}, - {1391866096, 0, 0}, - {1584369690, 0, 0}, - {1631216488, 0, 0}, - {1691646294, 0, 0}, - {1779143013, 0, 0}, - {1858116930, 0, 0}, - {1890300748, 0, 0}, - {1915438939, 0, 0}, - {1918742169, 0, 0}, - {1922045399, 0, 0}, - {1961990747, 0, 0}, - {2037710159, 0, 0}, - {2037814253, 0, 0}, - {2043873558, 0, 0}, - {2096388952, 0, 0}, - {2169307971, 0, 0}, - {2257843797, 0, 0}, - {2262220987, 0, 0}, - {2338272340, 0, 0}, - {2405770322, 0, 0}, - {2498042266, 0, 0}, - {2563789125, 0, 0}, - {2588618056, 0, 0}, - {2645120714, 0, 0}, - {2864863800, 0, 0}, - {2909957084, 0, 0}, - {2975894973, 0, 0}, - {3041450802, 0, 0}, - {3151638847, 0, 0}, - {3187066832, 0, 0}, - {3244716568, 0, 0}, - {3271748023, 0, 0}, - {3304438238, 0, 0}, - {3312467582, 0, 0}, - {3325419312, 0, 0}, - {3370185097, 0, 0}, - {3419674548, 0, 0}, - {3435931956, 0, 0}, - {3504158761, 0, 0}, - {3602522282, 0, 0}, - {3653059026, 0, 0}, - {3716353056, 0, 0}, - {3782099915, 0, 0}, - {3838648480, 0, 0}, - {3847846774, 0, 0}, - {3913593633, 0, 0}, - {3989799199, 0, 0}, - {3997038726, 0, 0}, - {4046301857, 0, 0}, - {4092654294, 0, 0}, - {4176581069, 0, 0}, - {4242327928, 0, 0}, - {4285652249, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 74, 38}, - {0, 12, 56}, - {0, 28, 24}, - {0, 60, 43}, - {0, 65, 72}, - {0, 18, 2}, - {0, 52, 3}, - {0, 19, 10}, - {0, 49, 36}, - {0, 67, 66}, - {0, 41, 17}, - {0, 53, 11}, - {0, 29, 68}, - {0, 26, 55}, - {0, 70, 76}, - {0, 73, 47}, - {0, 51, 22}, - {0, 39, 21}, - {0, 5, 9}, - {0, 40, 48}, - {0, 59, 44}, - {0, 6, 69}, - {0, 32, 31}, - {0, 4, 33}, - {0, 13, 54}, - {0, 14, 50}, - {0, 35, 75}, - {0, 58, 23}, - {0, 16, 34}, - {0, 27, 63}, - {0, 45, 61}, - {0, 20, 46}, - {0, 71, 1}, - {0, 79, 78}, - {0, 81, 80}, - {0, 83, 82}, - {0, 84, 8}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - {0, 96, 95}, - {0, 98, 97}, - {0, 64, 99}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 106, 62}, - {0, 108, 107}, - {0, 110, 109}, - {0, 7, 111}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 30, 124}, - {0, 126, 125}, - {0, 128, 127}, - {0, 130, 129}, - {0, 132, 131}, - {0, 134, 133}, - {0, 135, 25}, - {0, 57, 136}, - {0, 138, 137}, - {0, 42, 139}, - {0, 37, 140}, - {0, 142, 141}, - {0, 143, 15}, - {0, 145, 144}, - {0, 147, 146}, - {0, 149, 148}, - {0, 151, 150}, - {0, 152, 77}, - })); - - codecs.emplace(std::pair(SpvOpCompositeExtract, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(47, { - {0, 0, 0}, - {545678922, 0, 0}, - {630592085, 0, 0}, - {679771963, 0, 0}, - {899570100, 0, 0}, - {906176560, 0, 0}, - {929101967, 0, 0}, - {1100599986, 0, 0}, - {1103903216, 0, 0}, - {1107206446, 0, 0}, - {1369578001, 0, 0}, - {1372881231, 0, 0}, - {2320303498, 0, 0}, - {2926633629, 0, 0}, - {3249265647, 0, 0}, - {3334207724, 0, 0}, - {3486057732, 0, 0}, - {3674863070, 0, 0}, - {3705139860, 0, 0}, - {3800912395, 0, 0}, - {3802564010, 0, 0}, - {3822983876, 0, 0}, - {4141567741, 0, 0}, - {4292991777, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 9, 17}, - {0, 20, 11}, - {0, 25, 5}, - {0, 2, 14}, - {0, 23, 13}, - {0, 16, 26}, - {0, 27, 24}, - {0, 28, 8}, - {0, 29, 18}, - {0, 22, 30}, - {0, 6, 31}, - {0, 21, 32}, - {0, 3, 33}, - {0, 35, 34}, - {0, 1, 12}, - {0, 10, 36}, - {0, 37, 19}, - {0, 4, 15}, - {0, 39, 38}, - {0, 7, 40}, - {0, 42, 41}, - {0, 44, 43}, - {0, 46, 45}, - })); - - codecs.emplace(std::pair(SpvOpCompositeInsert, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(103, { - {0, 0, 0}, - {125792961, 0, 0}, - {132755933, 0, 0}, - {156014509, 0, 0}, - {436066778, 0, 0}, - {463084678, 0, 0}, - {531559080, 0, 0}, - {565233904, 0, 0}, - {578132535, 0, 0}, - {600906020, 0, 0}, - {602222721, 0, 0}, - {694743357, 0, 0}, - {760554870, 0, 0}, - {996663016, 0, 0}, - {1022309772, 0, 0}, - {1351676723, 0, 0}, - {1496901698, 0, 0}, - {1502470404, 0, 0}, - {1522901980, 0, 0}, - {1548254487, 0, 0}, - {1637661947, 0, 0}, - {1788504755, 0, 0}, - {2092468906, 0, 0}, - {2094647776, 0, 0}, - {2127660080, 0, 0}, - {2213946343, 0, 0}, - {2225172640, 0, 0}, - {2259467579, 0, 0}, - {2263866576, 0, 0}, - {2600961503, 0, 0}, - {2727022058, 0, 0}, - {2752967311, 0, 0}, - {2864705739, 0, 0}, - {3021406120, 0, 0}, - {3044723416, 0, 0}, - {3052439312, 0, 0}, - {3136865519, 0, 0}, - {3297860332, 0, 0}, - {3352361837, 0, 0}, - {3670298840, 0, 0}, - {3712946115, 0, 0}, - {3732709413, 0, 0}, - {3764662384, 0, 0}, - {3788324110, 0, 0}, - {3928555688, 0, 0}, - {4083347580, 0, 0}, - {4098876453, 0, 0}, - {4147239510, 0, 0}, - {4199470013, 0, 0}, - {4211577142, 0, 0}, - {4218799564, 0, 0}, - {4290374884, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 2}, - {0, 9, 8}, - {0, 17, 10}, - {0, 20, 18}, - {0, 22, 21}, - {0, 26, 23}, - {0, 31, 29}, - {0, 35, 34}, - {0, 45, 36}, - {0, 5, 3}, - {0, 12, 6}, - {0, 15, 14}, - {0, 25, 19}, - {0, 28, 27}, - {0, 38, 33}, - {0, 43, 39}, - {0, 47, 46}, - {0, 50, 49}, - {0, 7, 51}, - {0, 1, 48}, - {0, 37, 24}, - {0, 44, 42}, - {0, 13, 11}, - {0, 41, 40}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 60, 59}, - {0, 62, 61}, - {0, 64, 63}, - {0, 66, 65}, - {0, 68, 67}, - {0, 70, 69}, - {0, 72, 71}, - {0, 30, 16}, - {0, 73, 32}, - {0, 75, 74}, - {0, 77, 76}, - {0, 79, 78}, - {0, 81, 80}, - {0, 83, 82}, - {0, 85, 84}, - {0, 87, 86}, - {0, 89, 88}, - {0, 91, 90}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 52, 102}, - })); - - codecs.emplace(std::pair(SpvOpCompositeInsert, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(93, { - {0, 0, 0}, - {17185761, 0, 0}, - {117250846, 0, 0}, - {296981500, 0, 0}, - {330388453, 0, 0}, - {346929928, 0, 0}, - {533021259, 0, 0}, - {564302770, 0, 0}, - {680157484, 0, 0}, - {721450866, 0, 0}, - {798549062, 0, 0}, - {853200279, 0, 0}, - {864295921, 0, 0}, - {900522183, 0, 0}, - {973908139, 0, 0}, - {983243705, 0, 0}, - {1033363654, 0, 0}, - {1037370721, 0, 0}, - {1464587427, 0, 0}, - {1670691893, 0, 0}, - {1686512349, 0, 0}, - {1849065716, 0, 0}, - {1917602962, 0, 0}, - {1965902997, 0, 0}, - {2121980967, 0, 0}, - {2311072371, 0, 0}, - {2339901602, 0, 0}, - {2517964682, 0, 0}, - {2542834724, 0, 0}, - {2558655180, 0, 0}, - {2736881867, 0, 0}, - {2855506940, 0, 0}, - {2888753905, 0, 0}, - {2950446516, 0, 0}, - {3044188332, 0, 0}, - {3079287749, 0, 0}, - {3153451899, 0, 0}, - {3214537066, 0, 0}, - {3234673086, 0, 0}, - {3349230696, 0, 0}, - {3504158761, 0, 0}, - {3570411982, 0, 0}, - {3652695478, 0, 0}, - {3764205609, 0, 0}, - {3940720663, 0, 0}, - {4180570743, 0, 0}, - {4221373527, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 24, 18}, - {0, 4, 2}, - {0, 15, 14}, - {0, 21, 20}, - {0, 29, 26}, - {0, 42, 36}, - {0, 7, 45}, - {0, 37, 9}, - {0, 8, 5}, - {0, 32, 11}, - {0, 39, 38}, - {0, 12, 10}, - {0, 28, 19}, - {0, 1, 46}, - {0, 17, 6}, - {0, 30, 23}, - {0, 44, 33}, - {0, 35, 13}, - {0, 16, 48}, - {0, 50, 49}, - {0, 52, 51}, - {0, 54, 53}, - {0, 55, 40}, - {0, 57, 56}, - {0, 59, 58}, - {0, 61, 60}, - {0, 25, 22}, - {0, 63, 62}, - {0, 3, 64}, - {0, 66, 65}, - {0, 68, 67}, - {0, 70, 69}, - {0, 34, 71}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 27, 43}, - {0, 79, 78}, - {0, 81, 80}, - {0, 83, 82}, - {0, 84, 31}, - {0, 86, 85}, - {0, 41, 87}, - {0, 89, 88}, - {0, 91, 90}, - {0, 47, 92}, - })); - - codecs.emplace(std::pair(SpvOpCompositeInsert, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(115, { - {0, 0, 0}, - {132755933, 0, 0}, - {156014509, 0, 0}, - {255227811, 0, 0}, - {371186900, 0, 0}, - {371428004, 0, 0}, - {374731234, 0, 0}, - {531559080, 0, 0}, - {565233904, 0, 0}, - {578132535, 0, 0}, - {591140762, 0, 0}, - {600906020, 0, 0}, - {602222721, 0, 0}, - {656610661, 0, 0}, - {760554870, 0, 0}, - {996663016, 0, 0}, - {1022309772, 0, 0}, - {1496901698, 0, 0}, - {1502470404, 0, 0}, - {1522901980, 0, 0}, - {1536350567, 0, 0}, - {1543280290, 0, 0}, - {1548254487, 0, 0}, - {1788504755, 0, 0}, - {2064733527, 0, 0}, - {2092468906, 0, 0}, - {2094647776, 0, 0}, - {2162986400, 0, 0}, - {2225172640, 0, 0}, - {2259467579, 0, 0}, - {2263866576, 0, 0}, - {2360004627, 0, 0}, - {2507709226, 0, 0}, - {2600961503, 0, 0}, - {2727022058, 0, 0}, - {2752967311, 0, 0}, - {2864705739, 0, 0}, - {3021406120, 0, 0}, - {3052439312, 0, 0}, - {3136865519, 0, 0}, - {3297860332, 0, 0}, - {3352361837, 0, 0}, - {3598957382, 0, 0}, - {3619787319, 0, 0}, - {3655201337, 0, 0}, - {3670298840, 0, 0}, - {3774892253, 0, 0}, - {3788324110, 0, 0}, - {3808408202, 0, 0}, - {3951925872, 0, 0}, - {3952316364, 0, 0}, - {4098876453, 0, 0}, - {4147239510, 0, 0}, - {4199470013, 0, 0}, - {4211577142, 0, 0}, - {4217306348, 0, 0}, - {4218799564, 0, 0}, - {4290374884, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 43}, - {0, 4, 1}, - {0, 11, 9}, - {0, 13, 12}, - {0, 19, 18}, - {0, 25, 23}, - {0, 28, 26}, - {0, 35, 33}, - {0, 39, 38}, - {0, 2, 49}, - {0, 7, 3}, - {0, 16, 14}, - {0, 29, 22}, - {0, 37, 30}, - {0, 45, 41}, - {0, 51, 47}, - {0, 54, 52}, - {0, 57, 56}, - {0, 53, 8}, - {0, 32, 10}, - {0, 42, 40}, - {0, 24, 46}, - {0, 15, 50}, - {0, 55, 20}, - {0, 59, 44}, - {0, 61, 60}, - {0, 63, 62}, - {0, 65, 64}, - {0, 67, 66}, - {0, 69, 68}, - {0, 71, 70}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 31, 17}, - {0, 36, 34}, - {0, 79, 78}, - {0, 81, 80}, - {0, 27, 82}, - {0, 5, 21}, - {0, 48, 83}, - {0, 85, 84}, - {0, 87, 86}, - {0, 89, 88}, - {0, 91, 90}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 58, 114}, - })); - - codecs.emplace(std::pair(SpvOpCompositeInsert, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {3866587616, 0, 0}, - {3868239231, 0, 0}, - {3869890846, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 4}, - {0, 2, 5}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpSampledImage, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {1164218401, 0, 0}, - {2036361232, 0, 0}, - {2637132451, 0, 0}, - {3237903670, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 5}, - {0, 3, 6}, - {0, 1, 7}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpSampledImage, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {543558236, 0, 0}, - {1069781886, 0, 0}, - {1596005536, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 2, 5}, - {0, 1, 6}, - })); - - codecs.emplace(std::pair(SpvOpSampledImage, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1949759310, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpSampledImage, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(87, { - {0, 0, 0}, - {236660303, 0, 0}, - {347505241, 0, 0}, - {426360862, 0, 0}, - {439998433, 0, 0}, - {488500848, 0, 0}, - {495107308, 0, 0}, - {868652905, 0, 0}, - {1191735827, 0, 0}, - {1265998516, 0, 0}, - {1309728002, 0, 0}, - {1365842164, 0, 0}, - {1396344138, 0, 0}, - {1508074873, 0, 0}, - {1553476262, 0, 0}, - {1642818143, 0, 0}, - {1851510470, 0, 0}, - {1858116930, 0, 0}, - {1863199739, 0, 0}, - {1979978194, 0, 0}, - {1986584654, 0, 0}, - {2092100514, 0, 0}, - {2098706974, 0, 0}, - {2231688008, 0, 0}, - {2232491275, 0, 0}, - {2329992200, 0, 0}, - {2637935122, 0, 0}, - {2693892518, 0, 0}, - {2759250216, 0, 0}, - {2839765116, 0, 0}, - {2855895374, 0, 0}, - {2913136690, 0, 0}, - {3012980338, 0, 0}, - {3327770644, 0, 0}, - {3362344229, 0, 0}, - {3398925952, 0, 0}, - {3448018532, 0, 0}, - {3457985288, 0, 0}, - {3566035349, 0, 0}, - {3657635382, 0, 0}, - {3702405475, 0, 0}, - {3757479030, 0, 0}, - {3797204453, 0, 0}, - {4291477370, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 32, 28}, - {0, 9, 35}, - {0, 31, 11}, - {0, 10, 30}, - {0, 25, 21}, - {0, 40, 2}, - {0, 15, 19}, - {0, 24, 36}, - {0, 42, 4}, - {0, 18, 16}, - {0, 29, 26}, - {0, 43, 7}, - {0, 45, 8}, - {0, 37, 13}, - {0, 47, 46}, - {0, 48, 33}, - {0, 49, 14}, - {0, 3, 22}, - {0, 50, 12}, - {0, 41, 39}, - {0, 51, 34}, - {0, 52, 20}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 60, 59}, - {0, 61, 23}, - {0, 63, 62}, - {0, 65, 64}, - {0, 27, 66}, - {0, 67, 38}, - {0, 68, 17}, - {0, 70, 69}, - {0, 72, 71}, - {0, 74, 73}, - {0, 76, 75}, - {0, 5, 77}, - {0, 78, 1}, - {0, 80, 79}, - {0, 82, 81}, - {0, 83, 6}, - {0, 85, 84}, - {0, 44, 86}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(15, { - {0, 0, 0}, - {883854656, 0, 0}, - {1962971231, 0, 0}, - {2036361232, 0, 0}, - {2356768706, 0, 0}, - {2637132451, 0, 0}, - {3237903670, 0, 0}, - {3829682756, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 8, 2}, - {0, 6, 9}, - {0, 10, 7}, - {0, 4, 5}, - {0, 12, 11}, - {0, 3, 13}, - {0, 14, 1}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(87, { - {0, 0, 0}, - {150685616, 0, 0}, - {255302575, 0, 0}, - {414620710, 0, 0}, - {557400685, 0, 0}, - {575205902, 0, 0}, - {618761615, 0, 0}, - {646282397, 0, 0}, - {686024761, 0, 0}, - {740921498, 0, 0}, - {921246433, 0, 0}, - {1057578789, 0, 0}, - {1162127370, 0, 0}, - {1329499601, 0, 0}, - {1352628475, 0, 0}, - {1502028603, 0, 0}, - {1519723107, 0, 0}, - {1543798545, 0, 0}, - {1545450160, 0, 0}, - {1570165302, 0, 0}, - {1600392975, 0, 0}, - {1641415225, 0, 0}, - {2204920111, 0, 0}, - {2257971049, 0, 0}, - {2276405827, 0, 0}, - {2339018837, 0, 0}, - {2340670452, 0, 0}, - {2517964682, 0, 0}, - {2532518896, 0, 0}, - {2674090849, 0, 0}, - {2754074729, 0, 0}, - {2804281092, 0, 0}, - {2816338013, 0, 0}, - {2841008029, 0, 0}, - {3234673086, 0, 0}, - {3249261197, 0, 0}, - {3619787319, 0, 0}, - {3627739127, 0, 0}, - {3669223677, 0, 0}, - {3787567939, 0, 0}, - {3898287302, 0, 0}, - {4142016703, 0, 0}, - {4237092412, 0, 0}, - {4285779501, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 16, 15}, - {0, 2, 33}, - {0, 41, 35}, - {0, 32, 30}, - {0, 39, 38}, - {0, 5, 1}, - {0, 9, 43}, - {0, 40, 22}, - {0, 29, 12}, - {0, 4, 3}, - {0, 25, 37}, - {0, 34, 26}, - {0, 45, 19}, - {0, 31, 24}, - {0, 47, 46}, - {0, 48, 20}, - {0, 49, 6}, - {0, 8, 21}, - {0, 50, 11}, - {0, 13, 10}, - {0, 51, 42}, - {0, 52, 23}, - {0, 54, 53}, - {0, 56, 55}, - {0, 58, 57}, - {0, 60, 59}, - {0, 61, 28}, - {0, 63, 62}, - {0, 65, 64}, - {0, 17, 66}, - {0, 67, 18}, - {0, 68, 7}, - {0, 70, 69}, - {0, 72, 71}, - {0, 74, 73}, - {0, 76, 75}, - {0, 14, 77}, - {0, 78, 27}, - {0, 80, 79}, - {0, 82, 81}, - {0, 83, 36}, - {0, 85, 84}, - {0, 44, 86}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {2855506940, 0, 0}, - {3266548732, 0, 0}, - {3732640764, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 1}, - {0, 5, 4}, - {0, 3, 6}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(139, { - {0, 0, 0}, - {27177503, 0, 0}, - {30663912, 0, 0}, - {151672195, 0, 0}, - {162608772, 0, 0}, - {180913835, 0, 0}, - {371621315, 0, 0}, - {414444763, 0, 0}, - {421602934, 0, 0}, - {443347828, 0, 0}, - {458937500, 0, 0}, - {587888644, 0, 0}, - {601656217, 0, 0}, - {665789406, 0, 0}, - {712168842, 0, 0}, - {730943059, 0, 0}, - {750870327, 0, 0}, - {875212982, 0, 0}, - {899320334, 0, 0}, - {973908139, 0, 0}, - {989813600, 0, 0}, - {1057606514, 0, 0}, - {1171541710, 0, 0}, - {1243764146, 0, 0}, - {1310404265, 0, 0}, - {1366337101, 0, 0}, - {1443547269, 0, 0}, - {1472185378, 0, 0}, - {1473799048, 0, 0}, - {1543935193, 0, 0}, - {1572834111, 0, 0}, - {1623013158, 0, 0}, - {1686512349, 0, 0}, - {1705716306, 0, 0}, - {1747355813, 0, 0}, - {1755165354, 0, 0}, - {1781864804, 0, 0}, - {1916983087, 0, 0}, - {1941403425, 0, 0}, - {2023008475, 0, 0}, - {2043684541, 0, 0}, - {2274226560, 0, 0}, - {2285438321, 0, 0}, - {2315690100, 0, 0}, - {2344328209, 0, 0}, - {2414725163, 0, 0}, - {2493146691, 0, 0}, - {2495155989, 0, 0}, - {2558655180, 0, 0}, - {2577859137, 0, 0}, - {2857814560, 0, 0}, - {2895151306, 0, 0}, - {2986830770, 0, 0}, - {3006548167, 0, 0}, - {3127329373, 0, 0}, - {3157581152, 0, 0}, - {3216471040, 0, 0}, - {3296722158, 0, 0}, - {3367298820, 0, 0}, - {3376009661, 0, 0}, - {3450001968, 0, 0}, - {3526837441, 0, 0}, - {3609540589, 0, 0}, - {3743398113, 0, 0}, - {3858973601, 0, 0}, - {3953984401, 0, 0}, - {3999472204, 0, 0}, - {4088613871, 0, 0}, - {4184019303, 0, 0}, - {4258229445, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 31, 16}, - {0, 58, 47}, - {0, 21, 61}, - {0, 6, 14}, - {0, 65, 23}, - {0, 35, 5}, - {0, 2, 7}, - {0, 10, 25}, - {0, 40, 22}, - {0, 9, 50}, - {0, 20, 11}, - {0, 38, 36}, - {0, 13, 12}, - {0, 67, 28}, - {0, 71, 68}, - {0, 73, 72}, - {0, 3, 29}, - {0, 27, 8}, - {0, 44, 37}, - {0, 74, 63}, - {0, 76, 75}, - {0, 18, 1}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - {0, 26, 15}, - {0, 83, 43}, - {0, 85, 84}, - {0, 19, 86}, - {0, 48, 32}, - {0, 33, 46}, - {0, 87, 49}, - {0, 89, 88}, - {0, 91, 90}, - {0, 41, 30}, - {0, 52, 42}, - {0, 64, 55}, - {0, 92, 53}, - {0, 94, 93}, - {0, 51, 39}, - {0, 45, 95}, - {0, 66, 54}, - {0, 97, 96}, - {0, 57, 98}, - {0, 99, 69}, - {0, 101, 100}, - {0, 56, 102}, - {0, 4, 59}, - {0, 34, 17}, - {0, 103, 24}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 60, 110}, - {0, 111, 62}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 127, 126}, - {0, 129, 128}, - {0, 70, 130}, - {0, 132, 131}, - {0, 134, 133}, - {0, 136, 135}, - {0, 138, 137}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(11, { - {0, 0, 0}, - {883854656, 0, 0}, - {1962971231, 0, 0}, - {2036361232, 0, 0}, - {2366506734, 0, 0}, - {3829682756, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 2}, - {0, 6, 7}, - {0, 8, 5}, - {0, 3, 9}, - {0, 1, 10}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(73, { - {0, 0, 0}, - {178571546, 0, 0}, - {223310468, 0, 0}, - {388034151, 0, 0}, - {449954059, 0, 0}, - {694743357, 0, 0}, - {797415788, 0, 0}, - {835638766, 0, 0}, - {1002144380, 0, 0}, - {1221183390, 0, 0}, - {1570165302, 0, 0}, - {1663234329, 0, 0}, - {1750829822, 0, 0}, - {1894133125, 0, 0}, - {1967643923, 0, 0}, - {1980341560, 0, 0}, - {2278706468, 0, 0}, - {2326990117, 0, 0}, - {2464905186, 0, 0}, - {2511346984, 0, 0}, - {2517964682, 0, 0}, - {2616085763, 0, 0}, - {2710583246, 0, 0}, - {2745872368, 0, 0}, - {2924263085, 0, 0}, - {3027500544, 0, 0}, - {3044723416, 0, 0}, - {3202324433, 0, 0}, - {3289213933, 0, 0}, - {3323682385, 0, 0}, - {3366848728, 0, 0}, - {3417583519, 0, 0}, - {3732916270, 0, 0}, - {3787909072, 0, 0}, - {3877813395, 0, 0}, - {4028028350, 0, 0}, - {4178218543, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 36, 31}, - {0, 15, 3}, - {0, 17, 1}, - {0, 24, 12}, - {0, 35, 34}, - {0, 28, 27}, - {0, 21, 38}, - {0, 6, 13}, - {0, 14, 7}, - {0, 39, 25}, - {0, 40, 30}, - {0, 42, 41}, - {0, 32, 43}, - {0, 23, 9}, - {0, 11, 44}, - {0, 45, 22}, - {0, 47, 46}, - {0, 2, 16}, - {0, 49, 48}, - {0, 4, 50}, - {0, 51, 18}, - {0, 53, 52}, - {0, 33, 54}, - {0, 26, 55}, - {0, 57, 56}, - {0, 5, 58}, - {0, 59, 8}, - {0, 19, 60}, - {0, 10, 61}, - {0, 29, 62}, - {0, 37, 63}, - {0, 65, 64}, - {0, 67, 66}, - {0, 20, 68}, - {0, 70, 69}, - {0, 72, 71}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {2855506940, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 5), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(13, { - {0, 0, 0}, - {3533637837, 0, 0}, - {3535289452, 0, 0}, - {3536941067, 0, 0}, - {3538592682, 0, 0}, - {3540244297, 0, 0}, - {3541895912, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 7}, - {0, 2, 8}, - {0, 9, 3}, - {0, 4, 10}, - {0, 5, 11}, - {0, 12, 6}, - })); - - codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 6), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 5}, - {0, 2, 6}, - {0, 1, 3}, - {0, 8, 7}, - })); - - codecs.emplace(std::pair(SpvOpFAdd, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(45, { - {0, 0, 0}, - {328661377, 0, 0}, - {464259778, 0, 0}, - {920941800, 0, 0}, - {969500141, 0, 0}, - {1449907751, 0, 0}, - {1451831482, 0, 0}, - {1543798545, 0, 0}, - {1545450160, 0, 0}, - {1626224034, 0, 0}, - {1669930486, 0, 0}, - {1770165905, 0, 0}, - {2278571792, 0, 0}, - {2432827426, 0, 0}, - {2656211099, 0, 0}, - {2736844435, 0, 0}, - {2870852215, 0, 0}, - {2919626325, 0, 0}, - {2923708820, 0, 0}, - {3325419312, 0, 0}, - {3678875745, 0, 0}, - {4182141402, 0, 0}, - {4241374559, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 2, 6}, - {0, 9, 13}, - {0, 5, 15}, - {0, 4, 11}, - {0, 20, 22}, - {0, 10, 1}, - {0, 18, 14}, - {0, 16, 3}, - {0, 12, 21}, - {0, 8, 7}, - {0, 24, 17}, - {0, 19, 25}, - {0, 27, 26}, - {0, 29, 28}, - {0, 31, 30}, - {0, 33, 32}, - {0, 35, 34}, - {0, 37, 36}, - {0, 39, 38}, - {0, 41, 40}, - {0, 43, 42}, - {0, 23, 44}, - })); - - codecs.emplace(std::pair(SpvOpFAdd, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(89, { - {0, 0, 0}, - {135920445, 0, 0}, - {176166202, 0, 0}, - {294390719, 0, 0}, - {296981500, 0, 0}, - {743407979, 0, 0}, - {810488476, 0, 0}, - {837715723, 0, 0}, - {885020215, 0, 0}, - {922996215, 0, 0}, - {959681532, 0, 0}, - {963902061, 0, 0}, - {1136775085, 0, 0}, - {1189681639, 0, 0}, - {1203545131, 0, 0}, - {1297294717, 0, 0}, - {1317058015, 0, 0}, - {1352397672, 0, 0}, - {1367301635, 0, 0}, - {1412908157, 0, 0}, - {1570165302, 0, 0}, - {1763758554, 0, 0}, - {1791427568, 0, 0}, - {1992893964, 0, 0}, - {2013867381, 0, 0}, - {2096388952, 0, 0}, - {2219733501, 0, 0}, - {2383939514, 0, 0}, - {2517964682, 0, 0}, - {2555315060, 0, 0}, - {2572638469, 0, 0}, - {2762094724, 0, 0}, - {2770161927, 0, 0}, - {2855506940, 0, 0}, - {3044188332, 0, 0}, - {3187066832, 0, 0}, - {3319278167, 0, 0}, - {3653838348, 0, 0}, - {3675926744, 0, 0}, - {3701632935, 0, 0}, - {3712946115, 0, 0}, - {3732709413, 0, 0}, - {3743748793, 0, 0}, - {3783543823, 0, 0}, - {3930727258, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 15, 12}, - {0, 38, 16}, - {0, 41, 40}, - {0, 1, 33}, - {0, 21, 34}, - {0, 9, 2}, - {0, 24, 7}, - {0, 39, 44}, - {0, 29, 22}, - {0, 17, 19}, - {0, 36, 32}, - {0, 26, 18}, - {0, 30, 3}, - {0, 11, 8}, - {0, 42, 35}, - {0, 46, 31}, - {0, 27, 5}, - {0, 48, 47}, - {0, 28, 49}, - {0, 51, 50}, - {0, 52, 23}, - {0, 54, 53}, - {0, 13, 14}, - {0, 6, 55}, - {0, 57, 56}, - {0, 59, 58}, - {0, 60, 43}, - {0, 62, 61}, - {0, 37, 63}, - {0, 65, 64}, - {0, 67, 66}, - {0, 69, 68}, - {0, 70, 4}, - {0, 10, 71}, - {0, 72, 20}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - {0, 80, 79}, - {0, 81, 25}, - {0, 83, 82}, - {0, 85, 84}, - {0, 87, 86}, - {0, 45, 88}, - })); - - codecs.emplace(std::pair(SpvOpFAdd, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(103, { - {0, 0, 0}, - {126463145, 0, 0}, - {220008971, 0, 0}, - {246375791, 0, 0}, - {503145996, 0, 0}, - {628331516, 0, 0}, - {643418617, 0, 0}, - {743407979, 0, 0}, - {837715723, 0, 0}, - {858902117, 0, 0}, - {870594305, 0, 0}, - {939671928, 0, 0}, - {959681532, 0, 0}, - {1051471757, 0, 0}, - {1092948665, 0, 0}, - {1097775533, 0, 0}, - {1136775085, 0, 0}, - {1140367371, 0, 0}, - {1332643570, 0, 0}, - {1367301635, 0, 0}, - {1558001705, 0, 0}, - {1684282922, 0, 0}, - {2096388952, 0, 0}, - {2183547611, 0, 0}, - {2219733501, 0, 0}, - {2358141757, 0, 0}, - {2359973133, 0, 0}, - {2383939514, 0, 0}, - {2444465148, 0, 0}, - {2517964682, 0, 0}, - {2567901801, 0, 0}, - {2598189097, 0, 0}, - {2655147757, 0, 0}, - {2683080096, 0, 0}, - {2705434194, 0, 0}, - {2738307068, 0, 0}, - {2780898906, 0, 0}, - {3030911670, 0, 0}, - {3032677281, 0, 0}, - {3063300848, 0, 0}, - {3277199633, 0, 0}, - {3289969989, 0, 0}, - {3401762422, 0, 0}, - {3436143898, 0, 0}, - {3560552546, 0, 0}, - {3656163446, 0, 0}, - {3675926744, 0, 0}, - {3701632935, 0, 0}, - {3743748793, 0, 0}, - {3752211294, 0, 0}, - {3794803132, 0, 0}, - {4241374559, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 21}, - {0, 17, 11}, - {0, 36, 35}, - {0, 46, 45}, - {0, 50, 49}, - {0, 9, 3}, - {0, 20, 47}, - {0, 37, 31}, - {0, 2, 34}, - {0, 40, 13}, - {0, 51, 32}, - {0, 41, 10}, - {0, 38, 19}, - {0, 18, 44}, - {0, 43, 16}, - {0, 48, 24}, - {0, 26, 5}, - {0, 53, 8}, - {0, 15, 7}, - {0, 25, 23}, - {0, 54, 27}, - {0, 56, 55}, - {0, 58, 57}, - {0, 60, 59}, - {0, 39, 42}, - {0, 62, 61}, - {0, 30, 63}, - {0, 4, 64}, - {0, 65, 28}, - {0, 66, 22}, - {0, 68, 67}, - {0, 69, 14}, - {0, 70, 33}, - {0, 71, 6}, - {0, 73, 72}, - {0, 75, 74}, - {0, 29, 76}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - {0, 84, 83}, - {0, 86, 85}, - {0, 88, 87}, - {0, 90, 89}, - {0, 91, 12}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 52, 102}, - })); - - codecs.emplace(std::pair(SpvOpFAdd, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 5}, - {0, 4, 6}, - {0, 1, 7}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpFSub, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(159, { - {0, 0, 0}, - {50385656, 0, 0}, - {117250846, 0, 0}, - {171494987, 0, 0}, - {195244192, 0, 0}, - {210754155, 0, 0}, - {265392489, 0, 0}, - {333855951, 0, 0}, - {416853049, 0, 0}, - {529068443, 0, 0}, - {533021259, 0, 0}, - {615982737, 0, 0}, - {660038281, 0, 0}, - {663341511, 0, 0}, - {669812542, 0, 0}, - {716890919, 0, 0}, - {1081536219, 0, 0}, - {1119744229, 0, 0}, - {1123617794, 0, 0}, - {1139547465, 0, 0}, - {1162789888, 0, 0}, - {1178317551, 0, 0}, - {1190147516, 0, 0}, - {1193734351, 0, 0}, - {1215030156, 0, 0}, - {1220749418, 0, 0}, - {1318479490, 0, 0}, - {1461398554, 0, 0}, - {1486207619, 0, 0}, - {1551372768, 0, 0}, - {1763758554, 0, 0}, - {1797960910, 0, 0}, - {1850331254, 0, 0}, - {1894417995, 0, 0}, - {1964254745, 0, 0}, - {1965902997, 0, 0}, - {1989327599, 0, 0}, - {2095027856, 0, 0}, - {2123683379, 0, 0}, - {2124837447, 0, 0}, - {2137526937, 0, 0}, - {2269114589, 0, 0}, - {2269130237, 0, 0}, - {2330636993, 0, 0}, - {2481746922, 0, 0}, - {2503770904, 0, 0}, - {2589449658, 0, 0}, - {2603020391, 0, 0}, - {2604576561, 0, 0}, - {2795773560, 0, 0}, - {2835131395, 0, 0}, - {2852854788, 0, 0}, - {2890638791, 0, 0}, - {2895413148, 0, 0}, - {2950446516, 0, 0}, - {2963744582, 0, 0}, - {3079287749, 0, 0}, - {3088785099, 0, 0}, - {3280064277, 0, 0}, - {3335250889, 0, 0}, - {3510242586, 0, 0}, - {3517169445, 0, 0}, - {3518703473, 0, 0}, - {3536471583, 0, 0}, - {3579593979, 0, 0}, - {3591222197, 0, 0}, - {3673811979, 0, 0}, - {3727034815, 0, 0}, - {3730093054, 0, 0}, - {3898287302, 0, 0}, - {3944781937, 0, 0}, - {3950980241, 0, 0}, - {4033586023, 0, 0}, - {4041974454, 0, 0}, - {4052965752, 0, 0}, - {4083161638, 0, 0}, - {4167600590, 0, 0}, - {4185661467, 0, 0}, - {4237092412, 0, 0}, - {4244540017, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 44, 18}, - {0, 69, 57}, - {0, 24, 16}, - {0, 79, 5}, - {0, 59, 4}, - {0, 76, 40}, - {0, 53, 45}, - {0, 14, 2}, - {0, 62, 61}, - {0, 33, 75}, - {0, 38, 37}, - {0, 42, 58}, - {0, 66, 47}, - {0, 63, 67}, - {0, 1, 7}, - {0, 10, 3}, - {0, 13, 12}, - {0, 23, 22}, - {0, 32, 28}, - {0, 36, 35}, - {0, 72, 49}, - {0, 74, 73}, - {0, 77, 55}, - {0, 27, 41}, - {0, 31, 15}, - {0, 6, 54}, - {0, 78, 17}, - {0, 81, 56}, - {0, 83, 82}, - {0, 85, 84}, - {0, 48, 30}, - {0, 71, 60}, - {0, 65, 51}, - {0, 87, 86}, - {0, 50, 34}, - {0, 89, 88}, - {0, 90, 9}, - {0, 25, 8}, - {0, 92, 91}, - {0, 93, 26}, - {0, 95, 94}, - {0, 52, 39}, - {0, 29, 20}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 64, 102}, - {0, 104, 103}, - {0, 106, 105}, - {0, 21, 107}, - {0, 108, 68}, - {0, 109, 46}, - {0, 110, 11}, - {0, 112, 111}, - {0, 114, 113}, - {0, 116, 115}, - {0, 117, 70}, - {0, 43, 118}, - {0, 120, 119}, - {0, 122, 121}, - {0, 124, 123}, - {0, 126, 125}, - {0, 128, 127}, - {0, 129, 19}, - {0, 131, 130}, - {0, 133, 132}, - {0, 135, 134}, - {0, 137, 136}, - {0, 139, 138}, - {0, 141, 140}, - {0, 143, 142}, - {0, 145, 144}, - {0, 147, 146}, - {0, 149, 148}, - {0, 151, 150}, - {0, 153, 152}, - {0, 155, 154}, - {0, 157, 156}, - {0, 158, 80}, - })); - - codecs.emplace(std::pair(SpvOpFSub, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(103, { - {0, 0, 0}, - {50998433, 0, 0}, - {171494987, 0, 0}, - {249378857, 0, 0}, - {296981500, 0, 0}, - {508007510, 0, 0}, - {610429940, 0, 0}, - {660038281, 0, 0}, - {663341511, 0, 0}, - {836581417, 0, 0}, - {1027242654, 0, 0}, - {1167160774, 0, 0}, - {1191015885, 0, 0}, - {1200870684, 0, 0}, - {1203545131, 0, 0}, - {1265796414, 0, 0}, - {1319785741, 0, 0}, - {1669959736, 0, 0}, - {1684282922, 0, 0}, - {1752686878, 0, 0}, - {1850331254, 0, 0}, - {1901166356, 0, 0}, - {1906988301, 0, 0}, - {2055836767, 0, 0}, - {2095027856, 0, 0}, - {2096388952, 0, 0}, - {2144962711, 0, 0}, - {2217833278, 0, 0}, - {2500819054, 0, 0}, - {2525173102, 0, 0}, - {2575525651, 0, 0}, - {2660843182, 0, 0}, - {2855506940, 0, 0}, - {2918750759, 0, 0}, - {2919787747, 0, 0}, - {3091876332, 0, 0}, - {3187066832, 0, 0}, - {3244209297, 0, 0}, - {3423702268, 0, 0}, - {3508792859, 0, 0}, - {3548535223, 0, 0}, - {3619787319, 0, 0}, - {3653838348, 0, 0}, - {3692647551, 0, 0}, - {3713290482, 0, 0}, - {3753486980, 0, 0}, - {3783756895, 0, 0}, - {3797961332, 0, 0}, - {3836822275, 0, 0}, - {4043078107, 0, 0}, - {4052965752, 0, 0}, - {4091394002, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 31, 49}, - {0, 24, 19}, - {0, 46, 45}, - {0, 6, 48}, - {0, 12, 33}, - {0, 17, 21}, - {0, 43, 11}, - {0, 7, 2}, - {0, 9, 8}, - {0, 28, 13}, - {0, 44, 38}, - {0, 30, 50}, - {0, 26, 22}, - {0, 29, 51}, - {0, 34, 37}, - {0, 53, 40}, - {0, 23, 54}, - {0, 55, 25}, - {0, 27, 18}, - {0, 1, 10}, - {0, 57, 56}, - {0, 59, 58}, - {0, 5, 47}, - {0, 60, 20}, - {0, 62, 61}, - {0, 64, 63}, - {0, 66, 65}, - {0, 67, 39}, - {0, 69, 68}, - {0, 16, 70}, - {0, 3, 71}, - {0, 73, 72}, - {0, 41, 15}, - {0, 35, 74}, - {0, 76, 75}, - {0, 78, 77}, - {0, 36, 79}, - {0, 81, 80}, - {0, 83, 82}, - {0, 14, 84}, - {0, 86, 85}, - {0, 88, 87}, - {0, 32, 89}, - {0, 42, 90}, - {0, 92, 91}, - {0, 94, 93}, - {0, 96, 95}, - {0, 98, 97}, - {0, 52, 99}, - {0, 100, 4}, - {0, 102, 101}, - })); - - codecs.emplace(std::pair(SpvOpFSub, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(157, { - {0, 0, 0}, - {49456560, 0, 0}, - {170690025, 0, 0}, - {243178923, 0, 0}, - {295017943, 0, 0}, - {296981500, 0, 0}, - {330249537, 0, 0}, - {435256475, 0, 0}, - {443558693, 0, 0}, - {456043370, 0, 0}, - {470277359, 0, 0}, - {592180731, 0, 0}, - {663258455, 0, 0}, - {706238670, 0, 0}, - {810488476, 0, 0}, - {870594305, 0, 0}, - {877895868, 0, 0}, - {900522183, 0, 0}, - {1077859090, 0, 0}, - {1082941229, 0, 0}, - {1104362365, 0, 0}, - {1132589448, 0, 0}, - {1173092699, 0, 0}, - {1203545131, 0, 0}, - {1265796414, 0, 0}, - {1278818058, 0, 0}, - {1285705317, 0, 0}, - {1319785741, 0, 0}, - {1382106590, 0, 0}, - {1461897718, 0, 0}, - {1474506522, 0, 0}, - {1530183840, 0, 0}, - {1558001705, 0, 0}, - {1558990974, 0, 0}, - {1616846013, 0, 0}, - {1633850097, 0, 0}, - {1684282922, 0, 0}, - {1725011064, 0, 0}, - {1767704813, 0, 0}, - {1923453688, 0, 0}, - {1941148668, 0, 0}, - {1955104493, 0, 0}, - {2022961611, 0, 0}, - {2162274327, 0, 0}, - {2212501241, 0, 0}, - {2219733501, 0, 0}, - {2234361374, 0, 0}, - {2272221101, 0, 0}, - {2305269460, 0, 0}, - {2488410748, 0, 0}, - {2566666743, 0, 0}, - {2598189097, 0, 0}, - {2775815164, 0, 0}, - {2793529873, 0, 0}, - {2844616706, 0, 0}, - {2970183398, 0, 0}, - {3103302036, 0, 0}, - {3110479131, 0, 0}, - {3115038057, 0, 0}, - {3116932970, 0, 0}, - {3152745753, 0, 0}, - {3187066832, 0, 0}, - {3244209297, 0, 0}, - {3383007207, 0, 0}, - {3392887901, 0, 0}, - {3508792859, 0, 0}, - {3737376990, 0, 0}, - {3753486980, 0, 0}, - {3765247327, 0, 0}, - {3817149113, 0, 0}, - {3839047923, 0, 0}, - {3886529747, 0, 0}, - {4044928561, 0, 0}, - {4061558677, 0, 0}, - {4069720347, 0, 0}, - {4069810315, 0, 0}, - {4128942283, 0, 0}, - {4164704452, 0, 0}, - {4273793488, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 74, 47}, - {0, 34, 33}, - {0, 36, 14}, - {0, 61, 48}, - {0, 13, 31}, - {0, 39, 25}, - {0, 37, 29}, - {0, 65, 54}, - {0, 4, 73}, - {0, 38, 10}, - {0, 15, 43}, - {0, 6, 35}, - {0, 9, 16}, - {0, 30, 19}, - {0, 49, 44}, - {0, 57, 53}, - {0, 60, 58}, - {0, 72, 66}, - {0, 59, 76}, - {0, 1, 68}, - {0, 70, 42}, - {0, 63, 3}, - {0, 28, 69}, - {0, 17, 55}, - {0, 45, 64}, - {0, 81, 80}, - {0, 7, 82}, - {0, 12, 11}, - {0, 21, 50}, - {0, 83, 18}, - {0, 22, 84}, - {0, 85, 26}, - {0, 20, 86}, - {0, 87, 40}, - {0, 56, 88}, - {0, 90, 89}, - {0, 92, 91}, - {0, 93, 2}, - {0, 95, 94}, - {0, 97, 96}, - {0, 98, 41}, - {0, 100, 99}, - {0, 101, 52}, - {0, 103, 102}, - {0, 77, 71}, - {0, 104, 78}, - {0, 105, 46}, - {0, 32, 8}, - {0, 106, 51}, - {0, 108, 107}, - {0, 23, 109}, - {0, 110, 27}, - {0, 112, 111}, - {0, 113, 75}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 124, 62}, - {0, 126, 125}, - {0, 128, 127}, - {0, 67, 129}, - {0, 131, 130}, - {0, 5, 132}, - {0, 134, 133}, - {0, 136, 135}, - {0, 138, 137}, - {0, 139, 24}, - {0, 141, 140}, - {0, 143, 142}, - {0, 145, 144}, - {0, 147, 146}, - {0, 149, 148}, - {0, 151, 150}, - {0, 153, 152}, - {0, 79, 154}, - {0, 156, 155}, - })); - - codecs.emplace(std::pair(SpvOpFSub, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 5}, - {0, 3, 6}, - {0, 1, 7}, - {0, 8, 2}, - })); - - codecs.emplace(std::pair(SpvOpFMul, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(41, { - {0, 0, 0}, - {342197850, 0, 0}, - {885020215, 0, 0}, - {963902061, 0, 0}, - {1041368449, 0, 0}, - {1352397672, 0, 0}, - {1791427568, 0, 0}, - {2013867381, 0, 0}, - {2513230733, 0, 0}, - {2555315060, 0, 0}, - {2562485583, 0, 0}, - {2567901801, 0, 0}, - {2655147757, 0, 0}, - {2680283743, 0, 0}, - {2752766693, 0, 0}, - {2806716850, 0, 0}, - {3030911670, 0, 0}, - {3401762422, 0, 0}, - {3697738938, 0, 0}, - {4164704452, 0, 0}, - {4273793488, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 14, 10}, - {0, 7, 16}, - {0, 1, 15}, - {0, 9, 6}, - {0, 4, 12}, - {0, 18, 5}, - {0, 13, 2}, - {0, 19, 3}, - {0, 17, 20}, - {0, 23, 22}, - {0, 24, 8}, - {0, 26, 25}, - {0, 27, 11}, - {0, 29, 28}, - {0, 31, 30}, - {0, 33, 32}, - {0, 35, 34}, - {0, 37, 36}, - {0, 39, 38}, - {0, 21, 40}, - })); - - codecs.emplace(std::pair(SpvOpFMul, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(129, { - {0, 0, 0}, - {126463145, 0, 0}, - {129135650, 0, 0}, - {200922300, 0, 0}, - {328661377, 0, 0}, - {354479447, 0, 0}, - {360730278, 0, 0}, - {451264926, 0, 0}, - {529068443, 0, 0}, - {593829839, 0, 0}, - {742917749, 0, 0}, - {761731755, 0, 0}, - {810488476, 0, 0}, - {870594305, 0, 0}, - {894529125, 0, 0}, - {959681532, 0, 0}, - {1054461787, 0, 0}, - {1077859090, 0, 0}, - {1086964761, 0, 0}, - {1158929937, 0, 0}, - {1168927492, 0, 0}, - {1196280518, 0, 0}, - {1203545131, 0, 0}, - {1367301635, 0, 0}, - {1508550646, 0, 0}, - {1618544981, 0, 0}, - {1661163736, 0, 0}, - {1684282922, 0, 0}, - {1766994680, 0, 0}, - {1830851200, 0, 0}, - {1901166356, 0, 0}, - {1955104493, 0, 0}, - {2055836767, 0, 0}, - {2096388952, 0, 0}, - {2100052708, 0, 0}, - {2161102232, 0, 0}, - {2197904616, 0, 0}, - {2262137600, 0, 0}, - {2278571792, 0, 0}, - {2281956980, 0, 0}, - {2438466459, 0, 0}, - {2443959748, 0, 0}, - {2517964682, 0, 0}, - {2557754096, 0, 0}, - {2622612602, 0, 0}, - {2660843182, 0, 0}, - {2736844435, 0, 0}, - {2780898906, 0, 0}, - {3044188332, 0, 0}, - {3059119137, 0, 0}, - {3194725903, 0, 0}, - {3270430997, 0, 0}, - {3337532056, 0, 0}, - {3407526215, 0, 0}, - {3496407048, 0, 0}, - {3504158761, 0, 0}, - {3534518722, 0, 0}, - {3570411982, 0, 0}, - {3701632935, 0, 0}, - {3929248764, 0, 0}, - {3944781937, 0, 0}, - {3970432934, 0, 0}, - {4008405264, 0, 0}, - {4245257809, 0, 0}, - {4253051659, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 6, 26}, - {0, 46, 24}, - {0, 64, 50}, - {0, 7, 17}, - {0, 40, 57}, - {0, 56, 49}, - {0, 34, 10}, - {0, 32, 61}, - {0, 36, 44}, - {0, 8, 43}, - {0, 4, 18}, - {0, 25, 23}, - {0, 9, 54}, - {0, 45, 41}, - {0, 13, 21}, - {0, 47, 31}, - {0, 39, 53}, - {0, 11, 3}, - {0, 29, 20}, - {0, 38, 58}, - {0, 37, 14}, - {0, 66, 52}, - {0, 67, 35}, - {0, 48, 68}, - {0, 1, 69}, - {0, 70, 28}, - {0, 27, 63}, - {0, 72, 71}, - {0, 74, 73}, - {0, 75, 60}, - {0, 77, 76}, - {0, 5, 51}, - {0, 15, 78}, - {0, 30, 79}, - {0, 55, 80}, - {0, 42, 81}, - {0, 83, 82}, - {0, 85, 84}, - {0, 86, 2}, - {0, 19, 16}, - {0, 87, 59}, - {0, 62, 88}, - {0, 90, 89}, - {0, 22, 91}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 12, 102}, - {0, 104, 103}, - {0, 33, 105}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 127, 126}, - {0, 65, 128}, - })); - - codecs.emplace(std::pair(SpvOpFMul, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(127, { - {0, 0, 0}, - {13319433, 0, 0}, - {15502752, 0, 0}, - {162608772, 0, 0}, - {171307615, 0, 0}, - {296981500, 0, 0}, - {354479447, 0, 0}, - {413918748, 0, 0}, - {443490822, 0, 0}, - {487719832, 0, 0}, - {593829839, 0, 0}, - {615982737, 0, 0}, - {703543228, 0, 0}, - {810488476, 0, 0}, - {870594305, 0, 0}, - {875212982, 0, 0}, - {959681532, 0, 0}, - {1019457583, 0, 0}, - {1203545131, 0, 0}, - {1278448636, 0, 0}, - {1325348861, 0, 0}, - {1368383673, 0, 0}, - {1400019344, 0, 0}, - {1646147798, 0, 0}, - {1679946323, 0, 0}, - {1684282922, 0, 0}, - {1747355813, 0, 0}, - {1755648697, 0, 0}, - {1793544760, 0, 0}, - {1811839150, 0, 0}, - {1901166356, 0, 0}, - {1947620272, 0, 0}, - {1992893964, 0, 0}, - {2042001863, 0, 0}, - {2096388952, 0, 0}, - {2123388694, 0, 0}, - {2128251367, 0, 0}, - {2130747644, 0, 0}, - {2135340676, 0, 0}, - {2161102232, 0, 0}, - {2443959748, 0, 0}, - {2513230733, 0, 0}, - {2557754096, 0, 0}, - {2580096524, 0, 0}, - {2589449658, 0, 0}, - {2614879967, 0, 0}, - {2698156268, 0, 0}, - {2970183398, 0, 0}, - {3002890475, 0, 0}, - {3133016299, 0, 0}, - {3142155593, 0, 0}, - {3187066832, 0, 0}, - {3266548732, 0, 0}, - {3287039847, 0, 0}, - {3357301402, 0, 0}, - {3413713311, 0, 0}, - {3434076295, 0, 0}, - {3496407048, 0, 0}, - {3504158761, 0, 0}, - {3882634684, 0, 0}, - {3929248764, 0, 0}, - {3987079331, 0, 0}, - {4076840151, 0, 0}, - {4243119782, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 31, 8}, - {0, 14, 56}, - {0, 7, 12}, - {0, 9, 30}, - {0, 42, 36}, - {0, 19, 11}, - {0, 22, 40}, - {0, 15, 3}, - {0, 57, 26}, - {0, 58, 61}, - {0, 55, 51}, - {0, 48, 34}, - {0, 20, 1}, - {0, 24, 23}, - {0, 46, 35}, - {0, 59, 49}, - {0, 21, 63}, - {0, 62, 44}, - {0, 6, 50}, - {0, 28, 18}, - {0, 66, 65}, - {0, 41, 32}, - {0, 39, 54}, - {0, 53, 67}, - {0, 68, 37}, - {0, 33, 69}, - {0, 43, 70}, - {0, 71, 38}, - {0, 72, 27}, - {0, 13, 47}, - {0, 45, 73}, - {0, 75, 74}, - {0, 76, 5}, - {0, 77, 17}, - {0, 79, 78}, - {0, 52, 80}, - {0, 2, 81}, - {0, 83, 82}, - {0, 85, 84}, - {0, 87, 86}, - {0, 4, 88}, - {0, 16, 29}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - {0, 60, 95}, - {0, 97, 96}, - {0, 98, 10}, - {0, 25, 99}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 64, 126}, - })); - - codecs.emplace(std::pair(SpvOpFMul, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(9, { - {0, 0, 0}, - {679771963, 0, 0}, - {1951208733, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 4, 5}, - {0, 3, 6}, - {0, 7, 1}, - {0, 2, 8}, - })); - - codecs.emplace(std::pair(SpvOpFDiv, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(153, { - {0, 0, 0}, - {10142671, 0, 0}, - {27865391, 0, 0}, - {29517006, 0, 0}, - {41739659, 0, 0}, - {97231530, 0, 0}, - {171334650, 0, 0}, - {200553094, 0, 0}, - {257136089, 0, 0}, - {294390719, 0, 0}, - {375530199, 0, 0}, - {380957745, 0, 0}, - {388034151, 0, 0}, - {455591063, 0, 0}, - {462664429, 0, 0}, - {491456522, 0, 0}, - {502863753, 0, 0}, - {626480004, 0, 0}, - {643418617, 0, 0}, - {651464351, 0, 0}, - {701281393, 0, 0}, - {744817486, 0, 0}, - {783918780, 0, 0}, - {862784766, 0, 0}, - {930804377, 0, 0}, - {952536201, 0, 0}, - {955476870, 0, 0}, - {1043738701, 0, 0}, - {1047011733, 0, 0}, - {1080545747, 0, 0}, - {1137442027, 0, 0}, - {1235468610, 0, 0}, - {1412908157, 0, 0}, - {1431749301, 0, 0}, - {1434223270, 0, 0}, - {1440646342, 0, 0}, - {1508570930, 0, 0}, - {1510422521, 0, 0}, - {1548121999, 0, 0}, - {1582841441, 0, 0}, - {1612225949, 0, 0}, - {1665981878, 0, 0}, - {1680746207, 0, 0}, - {1696076631, 0, 0}, - {1702168830, 0, 0}, - {1761469971, 0, 0}, - {1799299383, 0, 0}, - {1910240213, 0, 0}, - {1917451875, 0, 0}, - {1945006185, 0, 0}, - {1998444837, 0, 0}, - {2045285083, 0, 0}, - {2217966239, 0, 0}, - {2279273489, 0, 0}, - {2289803479, 0, 0}, - {2348676810, 0, 0}, - {2353194283, 0, 0}, - {2403632109, 0, 0}, - {2409539315, 0, 0}, - {2414984922, 0, 0}, - {2477389837, 0, 0}, - {2524531022, 0, 0}, - {2573160348, 0, 0}, - {2639720559, 0, 0}, - {2773229577, 0, 0}, - {2796513469, 0, 0}, - {2881225774, 0, 0}, - {2890570341, 0, 0}, - {2952850186, 0, 0}, - {3023287679, 0, 0}, - {3118548424, 0, 0}, - {3877813395, 0, 0}, - {3931288033, 0, 0}, - {3972309363, 0, 0}, - {4117704995, 0, 0}, - {4140081844, 0, 0}, - {4258414038, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 74, 53}, - {0, 58, 52}, - {0, 65, 60}, - {0, 41, 5}, - {0, 1, 67}, - {0, 24, 28}, - {0, 27, 26}, - {0, 55, 31}, - {0, 36, 61}, - {0, 13, 49}, - {0, 56, 48}, - {0, 16, 64}, - {0, 76, 42}, - {0, 45, 29}, - {0, 23, 6}, - {0, 72, 12}, - {0, 35, 19}, - {0, 20, 7}, - {0, 21, 46}, - {0, 71, 78}, - {0, 80, 79}, - {0, 47, 17}, - {0, 81, 70}, - {0, 34, 25}, - {0, 83, 82}, - {0, 85, 84}, - {0, 37, 86}, - {0, 87, 73}, - {0, 10, 4}, - {0, 40, 30}, - {0, 88, 57}, - {0, 54, 89}, - {0, 50, 90}, - {0, 11, 91}, - {0, 39, 15}, - {0, 59, 44}, - {0, 92, 66}, - {0, 69, 93}, - {0, 95, 94}, - {0, 14, 96}, - {0, 98, 97}, - {0, 62, 51}, - {0, 100, 99}, - {0, 102, 101}, - {0, 104, 103}, - {0, 32, 43}, - {0, 105, 38}, - {0, 107, 106}, - {0, 109, 108}, - {0, 22, 9}, - {0, 33, 110}, - {0, 2, 111}, - {0, 112, 3}, - {0, 114, 113}, - {0, 116, 115}, - {0, 68, 63}, - {0, 118, 117}, - {0, 120, 119}, - {0, 121, 8}, - {0, 123, 122}, - {0, 125, 124}, - {0, 127, 126}, - {0, 129, 128}, - {0, 131, 130}, - {0, 133, 132}, - {0, 75, 18}, - {0, 135, 134}, - {0, 137, 136}, - {0, 139, 138}, - {0, 141, 140}, - {0, 143, 142}, - {0, 145, 144}, - {0, 147, 146}, - {0, 149, 148}, - {0, 150, 77}, - {0, 152, 151}, - })); - - codecs.emplace(std::pair(SpvOpFDiv, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(131, { - {0, 0, 0}, - {5908395, 0, 0}, - {139011596, 0, 0}, - {296981500, 0, 0}, - {342615870, 0, 0}, - {370232173, 0, 0}, - {492958971, 0, 0}, - {528662843, 0, 0}, - {551924251, 0, 0}, - {604894932, 0, 0}, - {610429940, 0, 0}, - {780957373, 0, 0}, - {810488476, 0, 0}, - {872544165, 0, 0}, - {878733439, 0, 0}, - {918849409, 0, 0}, - {959681532, 0, 0}, - {1013756921, 0, 0}, - {1038982109, 0, 0}, - {1081611718, 0, 0}, - {1125913837, 0, 0}, - {1209418480, 0, 0}, - {1318081294, 0, 0}, - {1367301635, 0, 0}, - {1417425499, 0, 0}, - {1625742020, 0, 0}, - {1684282922, 0, 0}, - {1746004874, 0, 0}, - {1758287856, 0, 0}, - {1777640493, 0, 0}, - {2066323109, 0, 0}, - {2094550054, 0, 0}, - {2096388952, 0, 0}, - {2144962711, 0, 0}, - {2434845539, 0, 0}, - {2480811229, 0, 0}, - {2552825357, 0, 0}, - {2636946065, 0, 0}, - {2651956495, 0, 0}, - {2669086217, 0, 0}, - {2680819379, 0, 0}, - {2709694527, 0, 0}, - {2715304020, 0, 0}, - {2790648021, 0, 0}, - {2802261839, 0, 0}, - {2806296851, 0, 0}, - {2864543087, 0, 0}, - {2952260510, 0, 0}, - {2963184673, 0, 0}, - {3091876332, 0, 0}, - {3098991995, 0, 0}, - {3131890669, 0, 0}, - {3138977758, 0, 0}, - {3198541202, 0, 0}, - {3260579369, 0, 0}, - {3263841912, 0, 0}, - {3335250889, 0, 0}, - {3345856521, 0, 0}, - {3381478137, 0, 0}, - {3489269251, 0, 0}, - {3510242586, 0, 0}, - {3820814597, 0, 0}, - {3900859293, 0, 0}, - {4041974454, 0, 0}, - {4244540017, 0, 0}, - {4265894873, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 15, 52}, - {0, 20, 18}, - {0, 39, 29}, - {0, 9, 43}, - {0, 22, 13}, - {0, 46, 27}, - {0, 51, 48}, - {0, 19, 57}, - {0, 34, 24}, - {0, 64, 59}, - {0, 5, 7}, - {0, 38, 37}, - {0, 45, 47}, - {0, 2, 56}, - {0, 67, 8}, - {0, 17, 68}, - {0, 69, 61}, - {0, 70, 6}, - {0, 55, 54}, - {0, 72, 71}, - {0, 4, 73}, - {0, 74, 40}, - {0, 30, 11}, - {0, 42, 36}, - {0, 75, 58}, - {0, 31, 76}, - {0, 1, 77}, - {0, 44, 14}, - {0, 78, 50}, - {0, 79, 23}, - {0, 26, 80}, - {0, 81, 12}, - {0, 83, 82}, - {0, 84, 21}, - {0, 32, 85}, - {0, 87, 86}, - {0, 35, 10}, - {0, 88, 62}, - {0, 90, 89}, - {0, 41, 91}, - {0, 92, 53}, - {0, 93, 63}, - {0, 95, 94}, - {0, 33, 96}, - {0, 98, 97}, - {0, 99, 3}, - {0, 100, 28}, - {0, 101, 49}, - {0, 102, 60}, - {0, 104, 103}, - {0, 106, 105}, - {0, 108, 107}, - {0, 110, 109}, - {0, 65, 111}, - {0, 25, 112}, - {0, 114, 113}, - {0, 116, 115}, - {0, 117, 16}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 127, 126}, - {0, 128, 66}, - {0, 130, 129}, - })); - - codecs.emplace(std::pair(SpvOpFDiv, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(95, { - {0, 0, 0}, - {116093251, 0, 0}, - {149720480, 0, 0}, - {183103444, 0, 0}, - {251209228, 0, 0}, - {296981500, 0, 0}, - {357505993, 0, 0}, - {394654115, 0, 0}, - {410274915, 0, 0}, - {452208841, 0, 0}, - {788046331, 0, 0}, - {797934924, 0, 0}, - {810488476, 0, 0}, - {1144188012, 0, 0}, - {1220127364, 0, 0}, - {1321616112, 0, 0}, - {1324351672, 0, 0}, - {1348149915, 0, 0}, - {1459457331, 0, 0}, - {1465623797, 0, 0}, - {1531216990, 0, 0}, - {1543672828, 0, 0}, - {1578775276, 0, 0}, - {1738815671, 0, 0}, - {1904128160, 0, 0}, - {2071351379, 0, 0}, - {2119793999, 0, 0}, - {2274779301, 0, 0}, - {2291766425, 0, 0}, - {2357410109, 0, 0}, - {2438466459, 0, 0}, - {2496463830, 0, 0}, - {2630220147, 0, 0}, - {2682510803, 0, 0}, - {3047649911, 0, 0}, - {3085703811, 0, 0}, - {3235459678, 0, 0}, - {3261703164, 0, 0}, - {3331487616, 0, 0}, - {3462674048, 0, 0}, - {3570219049, 0, 0}, - {3585315836, 0, 0}, - {3602108619, 0, 0}, - {3724004880, 0, 0}, - {3931641900, 0, 0}, - {3955205564, 0, 0}, - {4073492988, 0, 0}, - {4127308103, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 24, 37}, - {0, 13, 38}, - {0, 17, 39}, - {0, 35, 23}, - {0, 18, 36}, - {0, 46, 19}, - {0, 20, 33}, - {0, 47, 6}, - {0, 1, 45}, - {0, 3, 27}, - {0, 8, 49}, - {0, 50, 29}, - {0, 10, 51}, - {0, 43, 31}, - {0, 53, 52}, - {0, 54, 26}, - {0, 7, 55}, - {0, 56, 32}, - {0, 57, 41}, - {0, 59, 58}, - {0, 61, 60}, - {0, 63, 62}, - {0, 64, 25}, - {0, 2, 34}, - {0, 65, 14}, - {0, 67, 66}, - {0, 12, 21}, - {0, 9, 68}, - {0, 69, 16}, - {0, 71, 70}, - {0, 72, 44}, - {0, 11, 73}, - {0, 74, 30}, - {0, 4, 75}, - {0, 28, 15}, - {0, 76, 42}, - {0, 5, 77}, - {0, 78, 40}, - {0, 80, 79}, - {0, 82, 81}, - {0, 22, 83}, - {0, 85, 84}, - {0, 86, 48}, - {0, 88, 87}, - {0, 90, 89}, - {0, 92, 91}, - {0, 94, 93}, - })); - - codecs.emplace(std::pair(SpvOpFDiv, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(7, { - {0, 0, 0}, - {679771963, 0, 0}, - {2320303498, 0, 0}, - {3334207724, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 3, 4}, - {0, 2, 5}, - {0, 1, 6}, - })); - - codecs.emplace(std::pair(SpvOpVectorTimesScalar, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(121, { - {0, 0, 0}, - {14113753, 0, 0}, - {102358168, 0, 0}, - {179458548, 0, 0}, - {330388453, 0, 0}, - {386525753, 0, 0}, - {470277359, 0, 0}, - {497658126, 0, 0}, - {508007510, 0, 0}, - {815034111, 0, 0}, - {826214242, 0, 0}, - {849867303, 0, 0}, - {885645401, 0, 0}, - {939415664, 0, 0}, - {968885186, 0, 0}, - {1105835505, 0, 0}, - {1159301677, 0, 0}, - {1461897718, 0, 0}, - {1482251215, 0, 0}, - {1486206763, 0, 0}, - {1527762373, 0, 0}, - {1558990974, 0, 0}, - {1618754372, 0, 0}, - {1669959736, 0, 0}, - {1752686878, 0, 0}, - {2004567202, 0, 0}, - {2055637638, 0, 0}, - {2113506324, 0, 0}, - {2154320787, 0, 0}, - {2162274327, 0, 0}, - {2306141594, 0, 0}, - {2345566651, 0, 0}, - {2457690657, 0, 0}, - {2473053808, 0, 0}, - {2500422644, 0, 0}, - {2504802016, 0, 0}, - {2506771164, 0, 0}, - {2793529873, 0, 0}, - {2801333547, 0, 0}, - {2879050471, 0, 0}, - {3032677281, 0, 0}, - {3045470312, 0, 0}, - {3181546731, 0, 0}, - {3240977890, 0, 0}, - {3262572726, 0, 0}, - {3307100165, 0, 0}, - {3425841570, 0, 0}, - {3560552546, 0, 0}, - {3641833815, 0, 0}, - {3652695478, 0, 0}, - {3782362128, 0, 0}, - {3797961332, 0, 0}, - {3837583704, 0, 0}, - {3886529747, 0, 0}, - {3907920335, 0, 0}, - {4043078107, 0, 0}, - {4044928561, 0, 0}, - {4069720347, 0, 0}, - {4180570743, 0, 0}, - {4245743275, 0, 0}, - {4285201458, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 44, 28}, - {0, 13, 45}, - {0, 19, 15}, - {0, 32, 31}, - {0, 43, 42}, - {0, 16, 52}, - {0, 33, 22}, - {0, 57, 55}, - {0, 24, 21}, - {0, 2, 59}, - {0, 10, 3}, - {0, 18, 12}, - {0, 41, 39}, - {0, 60, 46}, - {0, 4, 25}, - {0, 58, 49}, - {0, 14, 1}, - {0, 27, 17}, - {0, 50, 36}, - {0, 23, 54}, - {0, 5, 30}, - {0, 11, 7}, - {0, 38, 29}, - {0, 37, 8}, - {0, 48, 56}, - {0, 20, 6}, - {0, 34, 26}, - {0, 63, 62}, - {0, 65, 64}, - {0, 67, 66}, - {0, 69, 68}, - {0, 71, 70}, - {0, 73, 72}, - {0, 75, 74}, - {0, 9, 76}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - {0, 84, 83}, - {0, 40, 35}, - {0, 85, 47}, - {0, 86, 51}, - {0, 88, 87}, - {0, 90, 89}, - {0, 53, 91}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 115, 114}, - {0, 117, 116}, - {0, 119, 118}, - {0, 61, 120}, - })); - - codecs.emplace(std::pair(SpvOpVectorTimesScalar, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(127, { - {0, 0, 0}, - {100979271, 0, 0}, - {269576093, 0, 0}, - {314809953, 0, 0}, - {354479447, 0, 0}, - {497658126, 0, 0}, - {882718761, 0, 0}, - {968885186, 0, 0}, - {973908139, 0, 0}, - {1019457583, 0, 0}, - {1191015885, 0, 0}, - {1266262705, 0, 0}, - {1310404265, 0, 0}, - {1325348861, 0, 0}, - {1367301635, 0, 0}, - {1368383673, 0, 0}, - {1570165302, 0, 0}, - {1618544981, 0, 0}, - {1646147798, 0, 0}, - {1674464100, 0, 0}, - {1679946323, 0, 0}, - {1686512349, 0, 0}, - {1766401548, 0, 0}, - {1774052499, 0, 0}, - {1788301425, 0, 0}, - {2023008475, 0, 0}, - {2055836767, 0, 0}, - {2096388952, 0, 0}, - {2123388694, 0, 0}, - {2129301998, 0, 0}, - {2212501241, 0, 0}, - {2274226560, 0, 0}, - {2362972044, 0, 0}, - {2378763734, 0, 0}, - {2506771164, 0, 0}, - {2558655180, 0, 0}, - {2622612602, 0, 0}, - {2660843182, 0, 0}, - {2698156268, 0, 0}, - {2801333547, 0, 0}, - {2850246066, 0, 0}, - {2895151306, 0, 0}, - {2970183398, 0, 0}, - {2986830770, 0, 0}, - {3001444829, 0, 0}, - {3133016299, 0, 0}, - {3152745753, 0, 0}, - {3187066832, 0, 0}, - {3261122899, 0, 0}, - {3496407048, 0, 0}, - {3513669836, 0, 0}, - {3536390697, 0, 0}, - {3570411982, 0, 0}, - {3653838348, 0, 0}, - {3713290482, 0, 0}, - {3858973601, 0, 0}, - {3873587660, 0, 0}, - {3877583949, 0, 0}, - {3882634684, 0, 0}, - {3907920335, 0, 0}, - {3997432565, 0, 0}, - {4169226615, 0, 0}, - {4219766939, 0, 0}, - {4243119782, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 25, 12}, - {0, 41, 29}, - {0, 56, 44}, - {0, 1, 3}, - {0, 48, 24}, - {0, 33, 60}, - {0, 8, 50}, - {0, 35, 21}, - {0, 11, 7}, - {0, 34, 23}, - {0, 59, 57}, - {0, 10, 62}, - {0, 40, 2}, - {0, 5, 49}, - {0, 39, 17}, - {0, 9, 61}, - {0, 30, 6}, - {0, 19, 46}, - {0, 53, 54}, - {0, 31, 52}, - {0, 55, 43}, - {0, 66, 65}, - {0, 16, 67}, - {0, 51, 68}, - {0, 70, 69}, - {0, 26, 36}, - {0, 72, 71}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - {0, 80, 79}, - {0, 82, 81}, - {0, 37, 83}, - {0, 85, 84}, - {0, 13, 86}, - {0, 20, 18}, - {0, 38, 28}, - {0, 58, 45}, - {0, 87, 63}, - {0, 15, 88}, - {0, 32, 22}, - {0, 89, 4}, - {0, 90, 14}, - {0, 91, 42}, - {0, 93, 92}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 115, 114}, - {0, 27, 47}, - {0, 117, 116}, - {0, 119, 118}, - {0, 121, 120}, - {0, 123, 122}, - {0, 125, 124}, - {0, 126, 64}, - })); - - codecs.emplace(std::pair(SpvOpVectorTimesScalar, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(137, { - {0, 0, 0}, - {11698369, 0, 0}, - {146392076, 0, 0}, - {151810803, 0, 0}, - {223800276, 0, 0}, - {227103506, 0, 0}, - {253329281, 0, 0}, - {346929928, 0, 0}, - {461040879, 0, 0}, - {629859130, 0, 0}, - {680157484, 0, 0}, - {783918780, 0, 0}, - {810488476, 0, 0}, - {824323032, 0, 0}, - {870594305, 0, 0}, - {959681532, 0, 0}, - {975807626, 0, 0}, - {1081642571, 0, 0}, - {1084574846, 0, 0}, - {1094817798, 0, 0}, - {1141965917, 0, 0}, - {1164137269, 0, 0}, - {1166917451, 0, 0}, - {1204787336, 0, 0}, - {1232501371, 0, 0}, - {1318479490, 0, 0}, - {1369818198, 0, 0}, - {1372785527, 0, 0}, - {1526654696, 0, 0}, - {1543672828, 0, 0}, - {1548121999, 0, 0}, - {1635292159, 0, 0}, - {1641070431, 0, 0}, - {1684282922, 0, 0}, - {1767704813, 0, 0}, - {1781765116, 0, 0}, - {1838763297, 0, 0}, - {1901166356, 0, 0}, - {1904846533, 0, 0}, - {2011183308, 0, 0}, - {2032069771, 0, 0}, - {2071351379, 0, 0}, - {2087004702, 0, 0}, - {2244928358, 0, 0}, - {2314864456, 0, 0}, - {2374216296, 0, 0}, - {2394332122, 0, 0}, - {2443610186, 0, 0}, - {2524697596, 0, 0}, - {2526961521, 0, 0}, - {2568098594, 0, 0}, - {2807907995, 0, 0}, - {3103302036, 0, 0}, - {3117071189, 0, 0}, - {3188115516, 0, 0}, - {3417584874, 0, 0}, - {3554463148, 0, 0}, - {3561482820, 0, 0}, - {3691770462, 0, 0}, - {3729929345, 0, 0}, - {3733675151, 0, 0}, - {3831290364, 0, 0}, - {3866493821, 0, 0}, - {3929248764, 0, 0}, - {4060703604, 0, 0}, - {4092487128, 0, 0}, - {4167600590, 0, 0}, - {4214779116, 0, 0}, - {4248015868, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 36, 13}, - {0, 49, 60}, - {0, 51, 9}, - {0, 3, 62}, - {0, 67, 41}, - {0, 4, 31}, - {0, 66, 5}, - {0, 55, 32}, - {0, 2, 1}, - {0, 30, 16}, - {0, 7, 38}, - {0, 19, 10}, - {0, 34, 20}, - {0, 45, 46}, - {0, 22, 11}, - {0, 25, 23}, - {0, 40, 39}, - {0, 21, 57}, - {0, 6, 35}, - {0, 61, 8}, - {0, 52, 26}, - {0, 70, 59}, - {0, 71, 14}, - {0, 68, 47}, - {0, 73, 72}, - {0, 29, 74}, - {0, 76, 75}, - {0, 77, 17}, - {0, 79, 78}, - {0, 81, 80}, - {0, 82, 18}, - {0, 83, 42}, - {0, 85, 84}, - {0, 87, 86}, - {0, 27, 37}, - {0, 53, 43}, - {0, 89, 88}, - {0, 64, 54}, - {0, 90, 65}, - {0, 92, 91}, - {0, 58, 93}, - {0, 56, 48}, - {0, 94, 28}, - {0, 96, 95}, - {0, 98, 97}, - {0, 44, 99}, - {0, 101, 100}, - {0, 15, 12}, - {0, 103, 102}, - {0, 104, 33}, - {0, 106, 105}, - {0, 108, 107}, - {0, 24, 109}, - {0, 111, 110}, - {0, 113, 112}, - {0, 114, 50}, - {0, 116, 115}, - {0, 118, 117}, - {0, 120, 119}, - {0, 122, 121}, - {0, 124, 123}, - {0, 126, 125}, - {0, 128, 127}, - {0, 129, 63}, - {0, 131, 130}, - {0, 133, 132}, - {0, 135, 134}, - {0, 136, 69}, - })); - - codecs.emplace(std::pair(SpvOpVectorTimesScalar, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1951208733, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpDot, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(97, { - {0, 0, 0}, - {78001013, 0, 0}, - {170690025, 0, 0}, - {206688607, 0, 0}, - {443490822, 0, 0}, - {461476226, 0, 0}, - {537830163, 0, 0}, - {669982125, 0, 0}, - {790502615, 0, 0}, - {805072272, 0, 0}, - {1173092699, 0, 0}, - {1220643281, 0, 0}, - {1448448666, 0, 0}, - {1466804584, 0, 0}, - {1473411044, 0, 0}, - {1515695460, 0, 0}, - {1587730355, 0, 0}, - {1625742020, 0, 0}, - {2071351379, 0, 0}, - {2250055803, 0, 0}, - {2291766425, 0, 0}, - {2416108131, 0, 0}, - {2427834344, 0, 0}, - {2436009347, 0, 0}, - {2455417440, 0, 0}, - {2480811229, 0, 0}, - {2654325647, 0, 0}, - {2919796598, 0, 0}, - {3047649911, 0, 0}, - {3088511797, 0, 0}, - {3104643263, 0, 0}, - {3198541202, 0, 0}, - {3204986803, 0, 0}, - {3272233597, 0, 0}, - {3383007207, 0, 0}, - {3602108619, 0, 0}, - {3622349409, 0, 0}, - {3714664910, 0, 0}, - {3717942504, 0, 0}, - {3732000233, 0, 0}, - {3759072440, 0, 0}, - {3765247327, 0, 0}, - {3805423332, 0, 0}, - {3829325073, 0, 0}, - {3866493821, 0, 0}, - {4058280485, 0, 0}, - {4061558677, 0, 0}, - {4148979936, 0, 0}, - {4155586396, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 13, 38}, - {0, 39, 14}, - {0, 44, 9}, - {0, 48, 47}, - {0, 23, 15}, - {0, 33, 25}, - {0, 1, 42}, - {0, 5, 46}, - {0, 31, 3}, - {0, 36, 28}, - {0, 16, 12}, - {0, 32, 22}, - {0, 41, 21}, - {0, 6, 50}, - {0, 51, 29}, - {0, 45, 34}, - {0, 37, 8}, - {0, 19, 52}, - {0, 11, 4}, - {0, 43, 40}, - {0, 27, 53}, - {0, 54, 10}, - {0, 24, 55}, - {0, 57, 56}, - {0, 58, 26}, - {0, 2, 59}, - {0, 61, 60}, - {0, 63, 62}, - {0, 65, 64}, - {0, 20, 66}, - {0, 30, 35}, - {0, 67, 17}, - {0, 68, 7}, - {0, 70, 69}, - {0, 71, 18}, - {0, 73, 72}, - {0, 75, 74}, - {0, 77, 76}, - {0, 79, 78}, - {0, 81, 80}, - {0, 83, 82}, - {0, 85, 84}, - {0, 87, 86}, - {0, 89, 88}, - {0, 91, 90}, - {0, 93, 92}, - {0, 95, 94}, - {0, 49, 96}, - })); - - codecs.emplace(std::pair(SpvOpDot, 1), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(117, { - {0, 0, 0}, - {50385656, 0, 0}, - {181902171, 0, 0}, - {560078433, 0, 0}, - {615982737, 0, 0}, - {674428451, 0, 0}, - {837715723, 0, 0}, - {886972033, 0, 0}, - {900101778, 0, 0}, - {983299427, 0, 0}, - {1237148906, 0, 0}, - {1364157225, 0, 0}, - {1367301635, 0, 0}, - {1380160211, 0, 0}, - {1451831482, 0, 0}, - {1499923635, 0, 0}, - {1570165302, 0, 0}, - {1735295265, 0, 0}, - {1766401548, 0, 0}, - {1796311149, 0, 0}, - {1826456251, 0, 0}, - {1839669171, 0, 0}, - {2012838864, 0, 0}, - {2024071551, 0, 0}, - {2096388952, 0, 0}, - {2161102232, 0, 0}, - {2197874825, 0, 0}, - {2279700640, 0, 0}, - {2289183712, 0, 0}, - {2351620600, 0, 0}, - {2362972044, 0, 0}, - {2472176885, 0, 0}, - {2477434291, 0, 0}, - {2530899578, 0, 0}, - {2531826164, 0, 0}, - {2558133383, 0, 0}, - {2589449658, 0, 0}, - {2621255555, 0, 0}, - {2622612602, 0, 0}, - {2872580757, 0, 0}, - {2881302403, 0, 0}, - {2891091137, 0, 0}, - {2923708820, 0, 0}, - {2936040203, 0, 0}, - {2970183398, 0, 0}, - {3187066832, 0, 0}, - {3224952074, 0, 0}, - {3244383472, 0, 0}, - {3261122899, 0, 0}, - {3362830643, 0, 0}, - {3538158875, 0, 0}, - {3635542517, 0, 0}, - {3682213068, 0, 0}, - {3721902098, 0, 0}, - {3826846522, 0, 0}, - {3877583949, 0, 0}, - {3997432565, 0, 0}, - {4093615095, 0, 0}, - {4106828015, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 52, 28}, - {0, 33, 20}, - {0, 46, 57}, - {0, 47, 54}, - {0, 21, 17}, - {0, 31, 58}, - {0, 12, 53}, - {0, 29, 3}, - {0, 35, 34}, - {0, 48, 41}, - {0, 8, 5}, - {0, 7, 55}, - {0, 37, 32}, - {0, 60, 38}, - {0, 61, 16}, - {0, 14, 62}, - {0, 23, 63}, - {0, 13, 19}, - {0, 64, 9}, - {0, 65, 39}, - {0, 2, 66}, - {0, 67, 42}, - {0, 69, 68}, - {0, 25, 70}, - {0, 1, 49}, - {0, 6, 71}, - {0, 72, 15}, - {0, 73, 11}, - {0, 75, 74}, - {0, 77, 76}, - {0, 4, 78}, - {0, 56, 50}, - {0, 80, 79}, - {0, 10, 81}, - {0, 83, 82}, - {0, 85, 84}, - {0, 86, 27}, - {0, 43, 40}, - {0, 88, 87}, - {0, 44, 24}, - {0, 30, 89}, - {0, 51, 36}, - {0, 45, 90}, - {0, 18, 91}, - {0, 93, 92}, - {0, 22, 94}, - {0, 26, 95}, - {0, 97, 96}, - {0, 99, 98}, - {0, 101, 100}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 111, 110}, - {0, 113, 112}, - {0, 59, 114}, - {0, 116, 115}, - })); - - codecs.emplace(std::pair(SpvOpDot, 2), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(179, { - {0, 0, 0}, - {27177503, 0, 0}, - {50385656, 0, 0}, - {129748122, 0, 0}, - {139011596, 0, 0}, - {162608772, 0, 0}, - {181902171, 0, 0}, - {225200779, 0, 0}, - {342159236, 0, 0}, - {386293029, 0, 0}, - {429023543, 0, 0}, - {443558693, 0, 0}, - {504514034, 0, 0}, - {615982737, 0, 0}, - {669812542, 0, 0}, - {674428451, 0, 0}, - {837715723, 0, 0}, - {861753115, 0, 0}, - {875212982, 0, 0}, - {876867882, 0, 0}, - {899320334, 0, 0}, - {900101778, 0, 0}, - {938517572, 0, 0}, - {1347339159, 0, 0}, - {1356063462, 0, 0}, - {1373856501, 0, 0}, - {1376656865, 0, 0}, - {1451831482, 0, 0}, - {1522979646, 0, 0}, - {1548491889, 0, 0}, - {1570165302, 0, 0}, - {1735295265, 0, 0}, - {1747355813, 0, 0}, - {1766401548, 0, 0}, - {1871105284, 0, 0}, - {1918742169, 0, 0}, - {1922045399, 0, 0}, - {1978689945, 0, 0}, - {2024071551, 0, 0}, - {2059975069, 0, 0}, - {2076833303, 0, 0}, - {2096388952, 0, 0}, - {2181030375, 0, 0}, - {2197874825, 0, 0}, - {2362972044, 0, 0}, - {2414725163, 0, 0}, - {2517964682, 0, 0}, - {2564745684, 0, 0}, - {2577387676, 0, 0}, - {2589449658, 0, 0}, - {2604242419, 0, 0}, - {2683080096, 0, 0}, - {2696349144, 0, 0}, - {2763960513, 0, 0}, - {2817823941, 0, 0}, - {2852854788, 0, 0}, - {2891091137, 0, 0}, - {2919626325, 0, 0}, - {2923708820, 0, 0}, - {2936040203, 0, 0}, - {2963744582, 0, 0}, - {2970183398, 0, 0}, - {2984459037, 0, 0}, - {2996594997, 0, 0}, - {3015046341, 0, 0}, - {3055195668, 0, 0}, - {3127329373, 0, 0}, - {3187066832, 0, 0}, - {3193597927, 0, 0}, - {3200890815, 0, 0}, - {3224258475, 0, 0}, - {3224480461, 0, 0}, - {3261122899, 0, 0}, - {3609540589, 0, 0}, - {3619404941, 0, 0}, - {3619626927, 0, 0}, - {3727034815, 0, 0}, - {3742724777, 0, 0}, - {3742946763, 0, 0}, - {3836179806, 0, 0}, - {3913885196, 0, 0}, - {3927338499, 0, 0}, - {3927466635, 0, 0}, - {3997432565, 0, 0}, - {3999472204, 0, 0}, - {4010499223, 0, 0}, - {4032662899, 0, 0}, - {4110915453, 0, 0}, - {4145966869, 0, 0}, - {4228303141, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 23, 87}, - {0, 9, 28}, - {0, 42, 17}, - {0, 74, 70}, - {0, 86, 77}, - {0, 18, 5}, - {0, 31, 32}, - {0, 34, 3}, - {0, 38, 68}, - {0, 50, 29}, - {0, 72, 62}, - {0, 21, 15}, - {0, 14, 54}, - {0, 56, 22}, - {0, 48, 88}, - {0, 2, 76}, - {0, 6, 47}, - {0, 26, 79}, - {0, 65, 12}, - {0, 37, 81}, - {0, 91, 60}, - {0, 30, 92}, - {0, 25, 7}, - {0, 45, 40}, - {0, 66, 52}, - {0, 71, 69}, - {0, 78, 75}, - {0, 84, 82}, - {0, 94, 93}, - {0, 27, 95}, - {0, 97, 96}, - {0, 99, 98}, - {0, 100, 39}, - {0, 55, 101}, - {0, 58, 102}, - {0, 89, 103}, - {0, 35, 11}, - {0, 104, 36}, - {0, 53, 10}, - {0, 1, 64}, - {0, 73, 20}, - {0, 105, 13}, - {0, 107, 106}, - {0, 8, 16}, - {0, 24, 19}, - {0, 85, 63}, - {0, 109, 108}, - {0, 111, 110}, - {0, 4, 112}, - {0, 114, 113}, - {0, 116, 115}, - {0, 118, 117}, - {0, 83, 119}, - {0, 121, 120}, - {0, 123, 122}, - {0, 49, 44}, - {0, 124, 57}, - {0, 125, 59}, - {0, 126, 67}, - {0, 128, 127}, - {0, 130, 129}, - {0, 132, 131}, - {0, 134, 133}, - {0, 135, 51}, - {0, 137, 136}, - {0, 138, 61}, - {0, 43, 41}, - {0, 140, 139}, - {0, 142, 141}, - {0, 144, 143}, - {0, 146, 145}, - {0, 148, 147}, - {0, 149, 33}, - {0, 80, 150}, - {0, 152, 151}, - {0, 154, 153}, - {0, 156, 155}, - {0, 158, 157}, - {0, 160, 159}, - {0, 162, 161}, - {0, 164, 163}, - {0, 166, 165}, - {0, 168, 167}, - {0, 46, 169}, - {0, 171, 170}, - {0, 90, 172}, - {0, 174, 173}, - {0, 176, 175}, - {0, 178, 177}, - })); - - codecs.emplace(std::pair(SpvOpDot, 3), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1036475267, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpLabel, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(3, { - {0, 0, 0}, - {1036475267, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 1, 2}, - })); - - codecs.emplace(std::pair(SpvOpBranch, 0), std::move(codec)); - } - - { - std::unique_ptr> codec(new HuffmanCodec(119, { - {0, 0, 0}, - {57149555, 0, 0}, - {139011596, 0, 0}, - {255835594, 0, 0}, - {330249537, 0, 0}, - {388686774, 0, 0}, - {508217552, 0, 0}, - {550831114, 0, 0}, - {559246409, 0, 0}, - {599185303, 0, 0}, - {649208064, 0, 0}, - {679061455, 0, 0}, - {810488476, 0, 0}, - {951841533, 0, 0}, - {1008886329, 0, 0}, - {1022544883, 0, 0}, - {1215030156, 0, 0}, - {1305703280, 0, 0}, - {1367301635, 0, 0}, - {1453447304, 0, 0}, - {1487177499, 0, 0}, - {1603937321, 0, 0}, - {1617826947, 0, 0}, - {1643868273, 0, 0}, - {1672607981, 0, 0}, - {1681941034, 0, 0}, - {1755165354, 0, 0}, - {1781864804, 0, 0}, - {1795715718, 0, 0}, - {1977038330, 0, 0}, - {2096388952, 0, 0}, - {2204920111, 0, 0}, - {2244470522, 0, 0}, - {2330636993, 0, 0}, - {2400601988, 0, 0}, - {2424848261, 0, 0}, - {2603020391, 0, 0}, - {2622612602, 0, 0}, - {2645135839, 0, 0}, - {2660843182, 0, 0}, - {2708915136, 0, 0}, - {2724166585, 0, 0}, - {2728667725, 0, 0}, - {2890638791, 0, 0}, - {2901034693, 0, 0}, - {2941648648, 0, 0}, - {2970183398, 0, 0}, - {2998120306, 0, 0}, - {3123244280, 0, 0}, - {3187066832, 0, 0}, - {3209399506, 0, 0}, - {3230260738, 0, 0}, - {3344189994, 0, 0}, - {3345707173, 0, 0}, - {3367298820, 0, 0}, - {3397078357, 0, 0}, - {3569736966, 0, 0}, - {3816961131, 0, 0}, - {4091670162, 0, 0}, - {4237497041, 0, 0}, - {1111111111111111111, 0, 0}, - {0, 17, 44}, - {0, 25, 20}, - {0, 29, 34}, - {0, 18, 2}, - {0, 54, 49}, - {0, 28, 7}, - {0, 47, 52}, - {0, 23, 56}, - {0, 55, 26}, - {0, 24, 61}, - {0, 13, 62}, - {0, 63, 45}, - {0, 27, 15}, - {0, 64, 8}, - {0, 65, 59}, - {0, 35, 22}, - {0, 53, 38}, - {0, 58, 51}, - {0, 11, 66}, - {0, 10, 3}, - {0, 46, 67}, - {0, 69, 68}, - {0, 1, 50}, - {0, 42, 19}, - {0, 70, 6}, - {0, 31, 71}, - {0, 16, 72}, - {0, 74, 73}, - {0, 76, 75}, - {0, 78, 77}, - {0, 79, 4}, - {0, 5, 37}, - {0, 14, 36}, - {0, 80, 57}, - {0, 81, 48}, - {0, 83, 82}, - {0, 39, 84}, - {0, 86, 85}, - {0, 40, 87}, - {0, 89, 88}, - {0, 91, 90}, - {0, 93, 92}, - {0, 21, 9}, - {0, 41, 32}, - {0, 12, 43}, - {0, 95, 94}, - {0, 97, 96}, - {0, 99, 98}, - {0, 100, 33}, - {0, 60, 101}, - {0, 103, 102}, - {0, 105, 104}, - {0, 107, 106}, - {0, 109, 108}, - {0, 110, 30}, - {0, 112, 111}, - {0, 114, 113}, - {0, 116, 115}, - {0, 118, 117}, - })); - - codecs.emplace(std::pair(SpvOpReturnValue, 0), std::move(codec)); - } - - return codecs; -} - -std::unordered_set GetDescriptorsWithCodingScheme() { - std::unordered_set descriptors_with_coding_scheme = { - 3816961131, - 3569736966, - 3397078357, - 3344189994, - 3230260738, - 2941648648, - 2901034693, - 2728667725, - 2400601988, - 1795715718, - 1681941034, - 1487177499, - 1453447304, - 679061455, - 649208064, - 559246409, - 388686774, - 4228303141, - 4110915453, - 4010499223, - 3927466635, - 3927338499, - 3836179806, - 3742724777, - 3619404941, - 3224480461, - 3224258475, - 3200890815, - 3742946763, - 3193597927, - 2604242419, - 2577387676, - 2181030375, - 1376656865, - 1347339159, - 938517572, - 876867882, - 429023543, - 129748122, - 4106828015, - 4093615095, - 3826846522, - 3721902098, - 3244383472, - 2891091137, - 2872580757, - 2558133383, - 2477434291, - 1839669171, - 2059975069, - 1735295265, - 1364157225, - 1237148906, - 886972033, - 674428451, - 4148979936, - 3805423332, - 3732000233, - 3717942504, - 3714664910, - 3622349409, - 3272233597, - 3204986803, - 3088511797, - 1672607981, - 2416108131, - 2250055803, - 1796311149, - 1515695460, - 537830163, - 461476226, - 206688607, - 78001013, - 3866493821, - 3417584874, - 3188115516, - 2526961521, - 2443610186, - 2394332122, - 2374216296, - 2032069771, - 2011183308, - 1904846533, - 1641070431, - 1635292159, - 1372785527, - 1369818198, - 1204787336, - 1826456251, - 1164137269, - 1081642571, - 629859130, - 253329281, - 227103506, - 11698369, - 4219766939, - 4169226615, - 3997432565, - 3873587660, - 3513669836, - 3261122899, - 2129301998, - 1774052499, - 1266262705, - 4285201458, - 4245743275, - 3907920335, - 3837583704, - 3641833815, - 3307100165, - 1232501371, - 3262572726, - 3045470312, - 2879050471, - 2801333547, - 2506771164, - 2504802016, - 2500422644, - 2473053808, - 2457690657, - 2345566651, - 2306141594, - 2154320787, - 2055637638, - 1527762373, - 1486206763, - 1159301677, - 1105835505, - 968885186, - 885645401, - 849867303, - 815034111, - 497658126, - 386525753, - 179458548, - 102358168, - 4127308103, - 4073492988, - 1473411044, - 805072272, - 3724004880, - 3602108619, - 3585315836, - 3331487616, - 3261703164, - 3235459678, - 3085703811, - 3047649911, - 2357410109, - 2291766425, - 2071351379, - 1904128160, - 1738815671, - 1531216990, - 1465623797, - 1324351672, - 1220127364, - 1144188012, - 183103444, - 116093251, - 3900859293, - 3345856521, - 3691770462, - 3263841912, - 3198541202, - 3098991995, - 3682213068, - 2963184673, - 2864543087, - 2802261839, - 2790648021, - 900101778, - 2715304020, - 100979271, - 2709694527, - 2669086217, - 2531826164, - 2651956495, - 2552825357, - 2480811229, - 3138977758, - 2434845539, - 2066323109, - 1777640493, - 1758287856, - 1746004874, - 3945482286, - 3932146199, - 3129573055, - 3126269825, - 3716914380, - 985750227, - 1543672828, - 3189039115, - 1839499483, - 2696349144, - 1536350567, - 3971481069, - 3001444829, - 4028622909, - 215293834, - 213642219, - 153085016, - 1189681639, - 165054168, - 29517006, - 2614879967, - 27865391, - 1649426421, - 4239834800, - 1947620272, - 28782128, - 3207966516, - 3713290482, - 2042001863, - 2724166585, - 2356768706, - 1793544760, - 4092654294, - 2157103435, - 2087004702, - 2043873558, - 27177503, - 1033363654, - 4214779116, - 408465899, - 451264926, - 2377112119, - 1182296898, - 760554870, - 3566035349, - 2630220147, - 4192247221, - 1572088444, - 3538592682, - 769422756, - 1674803691, - 630964591, - 3458449569, - 565334834, - 137840602, - 3955205564, - 2009007457, - 1258105452, - 333554713, - 3923810593, - 126463145, - 3445109809, - 2966409025, - 2849215484, - 1910240213, - 3131890669, - 586244865, - 2320303498, - 3116932970, - 1317265040, - 2812498065, - 1466938734, - 4064212479, - 2613179511, - 2095546797, - 1671139745, - 2568512089, - 3695940604, - 1119069977, - 215027449, - 4123141705, - 3495546641, - 1978689945, - 3202324433, - 3783543823, - 2674422363, - 1352628475, - 1290956281, - 1894417995, - 740921498, - 4211577142, - 1033081852, - 3884846406, - 3253403867, - 2790624748, - 2538917932, - 2144962711, - 3323202731, - 4290024976, - 2564745684, - 2963744582, - 2443959748, - 354479447, - 750870327, - 1918481917, - 4032662899, - 3587381650, - 2414725163, - 1081611718, - 1625742020, - 2308565678, - 1871105284, - 2807907995, - 2121980967, - 1054641568, - 413918748, - 1917336504, - 1816558243, - 4130950286, - 1522979646, - 1669959736, - 1320550031, - 3104643263, - 3823959661, - 3525913657, - 3584683259, - 2918750759, - 3536390697, - 94303122, - 3296691317, - 801484894, - 2496463830, - 3266028549, - 3085157904, - 973908139, - 3787909072, - 3107413701, - 2378763734, - 920604853, - 2516325050, - 1838993983, - 1603937321, - 3183924418, - 1945006185, - 3982311384, - 2682510803, - 680388473, - 979993429, - 2405770322, - 461040879, - 2817579280, - 14113753, - 2894979602, - 168339452, - 951841533, - 4154758669, - 2637132451, - 3877583949, - 1949856502, - 922996215, - 3941049054, - 4182141402, - 2262220987, - 1957218950, - 2094550054, - 1846856260, - 3499234137, - 3086631065, - 3054834317, - 593829839, - 522971108, - 1162127370, - 4233562270, - 2780190687, - 1558345254, - 3716353056, - 3518630848, - 1158929937, - 2038205856, - 86116519, - 4185661467, - 975807626, - 3910458990, - 4124281183, - 3361419439, - 171334650, - 2590402790, - 2890570341, - 2303184249, - 385229009, - 1998433745, - 1717510093, - 4022124023, - 1429389803, - 945128292, - 904486530, - 3869890846, - 619875033, - 459968607, - 3743748793, - 359054425, - 1417363940, - 3653985133, - 255835594, - 1047011733, - 2763232252, - 1329499601, - 328661377, - 2162274327, - 2100532220, - 4255182614, - 4243119782, - 3982047273, - 4053789056, - 401211099, - 950731750, - 1319785741, - 32085358, - 3882634684, - 3117071189, - 3554463148, - 3570219049, - 3535289452, - 2314864456, - 3913885196, - 2763960513, - 1079999262, - 27130513, - 3033873113, - 2976581453, - 2598189097, - 595410904, - 1572834111, - 13319433, - 1084574846, - 2123388694, - 560078433, - 1679946323, - 3518703473, - 184634770, - 296981500, - 1646147798, - 455591063, - 1325348861, - 3224952074, - 1027242654, - 2281956980, - 4221373527, - 1289566249, - 4044928561, - 882718761, - 1510333659, - 836581417, - 1901166356, - 2276405827, - 4052965752, - 1155765244, - 503145996, - 251209228, - 495107308, - 3944781937, - 37459569, - 4248015868, - 4198082194, - 1302400505, - 4106658327, - 680016782, - 2319227476, - 2738307068, - 3929248764, - 2850246066, - 1824526196, - 3912967080, - 3044723416, - 3133016299, - 2517964682, - 3647586740, - 3653838348, - 929101967, - 3571454885, - 2806296851, - 977312655, - 646282397, - 3448018532, - 824323032, - 204234270, - 1579585816, - 3712763835, - 1212872174, - 3953984401, - 3168953855, - 2944827576, - 1582841441, - 2796901051, - 3323682385, - 1317058015, - 2557550659, - 1620634991, - 2986830770, - 2490492987, - 1817271123, - 40653745, - 1696076631, - 2466126792, - 4169878842, - 3251128023, - 2444465148, - 678695941, - 2481746922, - 2836440943, - 774727851, - 2246405597, - 4028028350, - 2524697596, - 1977038330, - 2817823941, - 2219733501, - 688216667, - 3634598908, - 3232633974, - 2724625059, - 3269075805, - 3732640764, - 2263349224, - 1680746207, - 2414984922, - 2507457870, - 50998433, - 3092528578, - 3712946115, - 1543935193, - 807276090, - 1221183390, - 172029722, - 2122275289, - 3990925720, - 2261697609, - 2736881867, - 295017943, - 3278176820, - 3748965853, - 3174324790, - 1103903216, - 3184177968, - 1113409935, - 2299842241, - 2162986400, - 1538342947, - 4056442905, - 1631434666, - 205885885, - 1594733696, - 1955104493, - 1022309772, - 3820814597, - 993150979, - 1209418480, - 1784441183, - 3958731802, - 2250225826, - 3065160070, - 2024071551, - 107497541, - 628544021, - 2732195517, - 4241486415, - 3969279737, - 870594305, - 2916400082, - 1193734351, - 3202349435, - 3831290364, - 3282979782, - 3928764629, - 1308462133, - 3216471040, - 2433519008, - 2022961611, - 3604842236, - 3374978006, - 2855895374, - 3496407048, - 1482251215, - 3994511488, - 2997832431, - 1132589448, - 1348149915, - 2092468906, - 2451531615, - 779021139, - 3730093054, - 3413713311, - 1022915255, - 2204920111, - 2660843182, - 1080545747, - 1642805350, - 1766422419, - 4141567741, - 1558990974, - 4185590212, - 2841468319, - 701281393, - 3325419312, - 451957774, - 357505993, - 1156369516, - 3187387500, - 2259467579, - 2678954464, - 3154597438, - 543558236, - 2359973133, - 1990431740, - 2705477184, - 1041368449, - 3122368657, - 3181646225, - 1094423548, - 2955375511, - 2888125966, - 153013225, - 2936040203, - 1758530522, - 573901046, - 3030911670, - 1675922848, - 4235213885, - 4091916710, - 2633682514, - 4254584852, - 2328748202, - 3357301402, - 3877813395, - 2004567202, - 2496297824, - 3334207724, - 1600149091, - 293528591, - 1782996825, - 3757282300, - 1107206446, - 1092948665, - 1797960910, - 1206726575, - 1496351055, - 3021406120, - 99347751, - 3797204453, - 1468919488, - 797415788, - 1314843976, - 2934934694, - 490769168, - 1474506522, - 3811268385, - 864295921, - 3081676220, - 151810803, - 2588618056, - 2998120306, - 416853049, - 3495967422, - 3233393284, - 508007510, - 759277550, - 1971252067, - 869050696, - 810488476, - 745556697, - 789872778, - 3362723943, - 1617826947, - 3260309823, - 2197904616, - 1199157863, - 1643868273, - 2430404313, - 321630747, - 2503194620, - 3194725903, - 2881225774, - 3997952447, - 1389644742, - 2713718873, - 3585511591, - 1684282922, - 3366848728, - 284226441, - 1541020250, - 4018237905, - 1369578001, - 2424848261, - 2654325647, - 1626224034, - 1081536219, - 309040124, - 123060826, - 3997038726, - 1670691893, - 1543280290, - 443347828, - 1776629361, - 3118548424, - 478440524, - 679771963, - 3729929345, - 4244789645, - 2366506734, - 2838165089, - 1619778288, - 1313182965, - 3240680626, - 1323407757, - 883854656, - 2194691858, - 15502752, - 3760372982, - 1366337101, - 3656163446, - 295018543, - 825595257, - 57149555, - 2563789125, - 2353194283, - 2636942752, - 4026740269, - 3570411982, - 123108003, - 3782362128, - 1280126114, - 1410849099, - 4228502127, - 3609540589, - 3365041621, - 269823086, - 348988933, - 1636389511, - 2936586309, - 2761603302, - 2318200267, - 449954059, - 2895413148, - 1755165354, - 4274214049, - 778500192, - 3345707173, - 3732136051, - 721450866, - 1600392975, - 2466255445, - 4050155669, - 3541895912, - 1139547465, - 394654115, - 1380991098, - 3516240523, - 2234361374, - 1094817798, - 744817486, - 3564402361, - 1452222566, - 1851510470, - 3619787319, - 4265894873, - 216945449, - 3061690214, - 2910557180, - 255227811, - 4167600590, - 1587209598, - 3157581152, - 3184381405, - 2572638469, - 615748604, - 2532518896, - 1774874546, - 599185303, - 1561718045, - 1742737136, - 1674464100, - 3136865519, - 706016261, - 2793529873, - 3504981554, - 4155122613, - 2080953106, - 1104362365, - 2879917501, - 850497536, - 1392080469, - 1287937401, - 718877177, - 1917966999, - 1822823090, - 3701632935, - 3591222197, - 2817335337, - 1941148668, - 3110479131, - 3289213933, - 583624926, - 468372467, - 1633850097, - 2110223508, - 898191441, - 112745085, - 4018820793, - 3085119011, - 2919626325, - 3094857332, - 2348201466, - 2192810893, - 4163160985, - 1269075360, - 3952316364, - 2881886868, - 439764402, - 1584774136, - 169674806, - 3759072440, - 102542696, - 2996180816, - 804899022, - 1015552308, - 963902061, - 3504158761, - 2002490364, - 2806716850, - 265778447, - 4083122425, - 181902171, - 1238120570, - 75986790, - 1265796414, - 899570100, - 2988365258, - 3655201337, - 3654061472, - 3061856840, - 1077859090, - 615341051, - 3678875745, - 3349230696, - 3647606635, - 2549309392, - 1508570930, - 1766401548, - 1448448666, - 1499923635, - 2882994691, - 3674863070, - 3056042030, - 4240893633, - 1395113939, - 2964622752, - 1951208733, - 3536941067, - 4176581069, - 1203545131, - 3092754101, - 246375791, - 2736026107, - 1069781886, - 3687777340, - 1564342316, - 535067202, - 1395923345, - 3240977890, - 1447712361, - 2602027658, - 718301639, - 3123244280, - 1032593647, - 2840366496, - 2680819379, - 3839389658, - 277023757, - 1172110445, - 1755648697, - 2472176885, - 223800276, - 625975427, - 976111724, - 4145966869, - 2789375411, - 618087261, - 249378857, - 4058280485, - 827698488, - 1558001705, - 3561482820, - 2562485583, - 4243138030, - 615982737, - 1220643281, - 150685616, - 3091876332, - 1040775722, - 669982125, - 4116080964, - 3582002820, - 910398460, - 1036475267, - 3800912395, - 146392076, - 1686512349, - 2326636627, - 2839816704, - 3502816184, - 226836633, - 3953733490, - 257136089, - 819503463, - 2863084840, - 1949759310, - 210754155, - 1367301635, - 3822983876, - 4273793488, - 3635397748, - 3930494584, - 3127921440, - 3167253437, - 3868239231, - 1859128680, - 3480031018, - 3810805277, - 2677252364, - 156014509, - 3627739127, - 2321729979, - 1146476634, - 4039938779, - 1964254745, - 2055836767, - 119981689, - 2629265310, - 2448331885, - 3737376990, - 144116905, - 2272221101, - 2197874825, - 1277245109, - 2503770904, - 360730278, - 3489360962, - 1166917451, - 707478563, - 4155586396, - 162255877, - 347505241, - 4215670524, - 3187066832, - 2399809085, - 2754074729, - 4060703604, - 628331516, - 1304296041, - 616435646, - 4080527786, - 1443829854, - 2512398201, - 708736129, - 13107491, - 3794803132, - 2049792025, - 2455417440, - 3367313400, - 3357250579, - 3694383800, - 2339901602, - 3242843022, - 2282454607, - 1243764146, - 835458563, - 1297706389, - 464259778, - 1766994680, - 1294403159, - 2568098594, - 3107165180, - 4040340620, - 3352361837, - 1031290113, - 2903897222, - 1677700667, - 3160388974, - 107544081, - 3044188332, - 2285081596, - 2835131395, - 2984459037, - 4174489262, - 1236389532, - 2938237924, - 321459212, - 3407526215, - 300939750, - 3441531391, - 2909957084, - 3192069648, - 1849065716, - 2524531022, - 505940164, - 4121643374, - 3774892253, - 3197739982, - 2161102232, - 2715370488, - 1992893964, - 1781864804, - 587888644, - 1039111164, - 4237497041, - 451382997, - 969500141, - 1415510495, - 3743398113, - 3027538652, - 2525173102, - 1708264968, - 3366040354, - 1100599986, - 188347929, - 2597020383, - 2705434194, - 2593884753, - 3472123498, - 2975894973, - 3152745753, - 1154919607, - 1930923350, - 3287039847, - 1372881231, - 2280400314, - 3369343584, - 2351620600, - 2645135839, - 2752766693, - 1471851763, - 1989520052, - 1141965917, - 1503477720, - 653708953, - 1765126703, - 2432827426, - 95470391, - 2567901801, - 2589449658, - 4218799564, - 3249265647, - 3673811979, - 210116709, - 1593584949, - 1791352211, - 3457985288, - 3345288309, - 531559080, - 2491124112, - 3410158390, - 4224872590, - 3705139860, - 162608772, - 4258229445, - 925559698, - 3928842969, - 4253051659, - 3633746133, - 3867307935, - 3560665067, - 798915737, - 2945369269, - 2677264274, - 2278571792, - 177111659, - 85880059, - 1297165140, - 1630583316, - 2232491275, - 1848784182, - 2487708241, - 626480004, - 3427283542, - 2108571893, - 304448521, - 3332104493, - 2244470522, - 436416061, - 221900294, - 1502470404, - 3552593177, - 440421571, - 450406196, - 503094540, - 3836822275, - 2708915136, - 3750617468, - 1119744229, - 3614752756, - 921246433, - 2285438321, - 626892406, - 2362972044, - 72782198, - 2929019254, - 2795773560, - 907126242, - 155458798, - 2798552666, - 1404739463, - 4285652249, - 1998444837, - 908777857, - 872544165, - 910429472, - 135486769, - 3457269042, - 426360862, - 1725011064, - 296836635, - 1322549027, - 2044728014, - 1530183840, - 529742207, - 4272200782, - 1341516288, - 2608484640, - 41739659, - 3260579369, - 2745872368, - 2894051250, - 862784766, - 3077271274, - 3094180193, - 3619626927, - 3745223676, - 2976066508, - 2854085372, - 2959147533, - 3266548732, - 1776526161, - 3712296962, - 1955871800, - 2580096524, - 2507709226, - 3564865233, - 948086521, - 1548254487, - 142465290, - 1472185378, - 1459457331, - 2274226560, - 3153451899, - 492958971, - 3563213618, - 1285705317, - 410274915, - 3710645347, - 1309728002, - 2119793999, - 1343794461, - 4024173916, - 2383939514, - 955476870, - 2698156268, - 35240468, - 2655147757, - 3764205609, - 3802564010, - 170690025, - 2311941439, - 3181546731, - 3866587616, - 3648138580, - 93914936, - 170378107, - 2120623674, - 1064945649, - 1618754372, - 244668133, - 247698428, - 3669223677, - 470277359, - 1781765116, - 1691572958, - 1373856501, - 2668769415, - 1087394637, - 1009983433, - 2180701723, - 4008405264, - 2831059514, - 2645120714, - 2649103430, - 2664825925, - 790502615, - 1739837626, - 2293247016, - 1784648440, - 1887808856, - 1788504755, - 112452386, - 1979978194, - 3462674048, - 2170273742, - 538168945, - 753954113, - 374731234, - 3715846592, - 1962971231, - 1860649552, - 1378082995, - 665789406, - 1717555224, - 139011596, - 1375043498, - 1618544981, - 1889460471, - 2262321736, - 1788301425, - 1652168174, - 2668680621, - 2636946065, - 2856623532, - 2759951687, - 959681532, - 3209399506, - 3055195668, - 1227221002, - 508217552, - 3289969989, - 243178923, - 2956189845, - 3075866530, - 2274779301, - 3940720663, - 3998230222, - 1178317551, - 4016096296, - 1545450160, - 2842919847, - 314809953, - 2952850186, - 3747079365, - 4147239510, - 169135842, - 1332643570, - 2994529201, - 973521782, - 1584369690, - 1043738701, - 2851900832, - 290391815, - 283209196, - 2468230023, - 1164221089, - 1991787192, - 3358097187, - 51041423, - 52882140, - 2339018837, - 2053214130, - 3757479030, - 158160339, - 853200279, - 1986584654, - 438318340, - 827246872, - 3299488628, - 2924263085, - 3472029049, - 2736844435, - 677668732, - 604894932, - 1158021131, - 1400019344, - 2268204687, - 1450415100, - 3854557817, - 1543646433, - 1278448636, - 342615870, - 1554194368, - 3080024605, - 3423702268, - 1675764636, - 1622381564, - 2078849875, - 2113115132, - 1380160211, - 3132876285, - 125015036, - 269576093, - 94145952, - 2777172031, - 2683080096, - 3812456892, - 488500848, - 3270430997, - 2895151306, - 116376005, - 400248103, - 406044930, - 1616846013, - 10142671, - 763027711, - 225200779, - 1062250709, - 2013867381, - 2113506324, - 1692932387, - 1827244161, - 3124618210, - 2096472894, - 2924146124, - 2128251367, - 2433358586, - 1939359710, - 2593325766, - 2879917723, - 694743357, - 2902069960, - 220008971, - 3090408469, - 917019124, - 1705716306, - 3263901372, - 3347863687, - 3447882276, - 1661163736, - 3617689692, - 3928555688, - 1057578789, - 435256475, - 4101009465, - 1941403425, - 198967948, - 3733675151, - 2043684541, - 3517169445, - 2226776400, - 2853403709, - 529383565, - 2807448986, - 4234287173, - 1019457583, - 1022544883, - 2493146691, - 1054461787, - 1008886329, - 1136775085, - 1191015885, - 1196280518, - 1979847999, - 50385656, - 1918742169, - 3999472204, - 3697687030, - 2220475432, - 2358141757, - 2360004627, - 4245257809, - 236660303, - 429277936, - 342159236, - 2622612602, - 371428004, - 373079619, - 643418617, - 2095027856, - 1071164424, - 1136911283, - 1548491889, - 2169307971, - 375530199, - 1510422521, - 3151638847, - 1698730948, - 2231688008, - 2604576561, - 2771938750, - 2996594997, - 289648234, - 348584153, - 2748350697, - 2926633629, - 2123683379, - 369686787, - 742917749, - 3538158875, - 2937761472, - 1545298048, - 1321616112, - 2855506940, - 900522183, - 1578775276, - 2217833278, - 2012838864, - 3753486980, - 2839765116, - 2464905186, - 2621255555, - 1305703280, - 861753115, - 3319278167, - 3063300848, - 149720480, - 1082941229, - 3337532056, - 2248357849, - 3675926744, - 1508550646, - 2289803479, - 3456899824, - 3931641900, - 3970432934, - 3419674548, - 1093210099, - 456043370, - 848380423, - 1287304304, - 1526654696, - 2055664760, - 1373166395, - 4291477370, - 2195550588, - 2847102741, - 3399062057, - 1641565587, - 2888753905, - 3579593979, - 3653059026, - 3757851979, - 2922615804, - 2919796598, - 1553476262, - 2566666743, - 3759503594, - 550831114, - 3761155209, - 3762806824, - 3902853271, - 4140081844, - 14244860, - 3847846774, - 150820676, - 1278818058, - 850592577, - 1206571206, - 1734446471, - 2117320444, - 1382106590, - 2436009347, - 2118972059, - 2951272396, - 36096192, - 117998987, - 473485679, - 2244928358, - 476788909, - 3489269251, - 610429940, - 480092139, - 481743754, - 871966503, - 918189168, - 601656217, - 933769938, - 939671928, - 1799299383, - 3312467582, - 1149665466, - 3006548167, - 1310740861, - 3602693817, - 1461645203, - 3367691969, - 1800404122, - 3486057732, - 1862284649, - 2076833303, - 2213411495, - 2805256437, - 3927915220, - 3000904950, - 2094647776, - 3333131702, - 1315613425, - 3752211294, - 603915804, - 3505028338, - 663258455, - 3322500634, - 1612225949, - 3606320646, - 157110413, - 1352397672, - 3861006967, - 452208841, - 18776483, - 1058429216, - 37009196, - 564884461, - 876864198, - 2952260510, - 2860348412, - 928261291, - 1164724902, - 2775815164, - 1332774287, - 780957373, - 939415664, - 1513770932, - 788046331, - 1692600167, - 4069810315, - 673708384, - 4024252457, - 1932614728, - 2148510256, - 3131224670, - 2388524817, - 2460489993, - 2676385521, - 826214242, - 3692647551, - 3063508455, - 3071766530, - 2063832060, - 1525861001, - 3073418145, - 837715723, - 3075069760, - 3076721375, - 3078372990, - 983243705, - 3083327835, - 171307615, - 1824016656, - 3084979450, - 1310404265, - 1775308984, - 3114708520, - 3116360135, - 3121314980, - 3134527900, - 1691646294, - 2804281092, - 97231530, - 3136179515, - 3204260786, - 3276225962, - 1220749418, - 3588205699, - 3874089391, - 4044115788, - 3268751013, - 743407979, - 166253838, - 1356063462, - 1368383673, - 2279700640, - 2130747644, - 3945795573, - 2780898906, - 3635542517, - 425022309, - 517919178, - 4061558677, - 2190437442, - 543621065, - 753756604, - 2500819054, - 1004589179, - 1165671422, - 30433743, - 3444275347, - 1335363438, - 1913735398, - 1265998516, - 3829325073, - 3662767579, - 463084678, - 1351676723, - 1391866096, - 3398925952, - 1631216488, - 815757910, - 1915438939, - 2427834344, - 1445161581, - 1890300748, - 2864863800, - 1961990747, - 575205902, - 2037710159, - 2037814253, - 617312262, - 3732916270, - 783918780, - 2257843797, - 2096388952, - 2338272340, - 1434223270, - 578132535, - 1980341560, - 1002144380, - 3244716568, - 4258414038, - 3271748023, - 3304438238, - 3717523241, - 3370185097, - 3435931956, - 1957265068, - 3602522282, - 2547657777, - 439998433, - 3838648480, - 3913593633, - 3989799199, - 906176560, - 1894133125, - 4046301857, - 4242327928, - 630592085, - 2693892518, - 4292991777, - 545678922, - 125792961, - 3015046341, - 132755933, - 2615111110, - 1570165302, - 1440646342, - 436066778, - 565233904, - 600906020, - 602222721, - 3951925872, - 1496901698, - 1522901980, - 2785441472, - 3041450802, - 1637661947, - 2127660080, - 3487022798, - 2269114589, - 1314834580, - 2315690100, - 3817149113, - 4091670162, - 1431749301, - 1858116930, - 2213946343, - 2225172640, - 2263866576, - 2727022058, - 2752967311, - 2864705739, - 3052439312, - 3510257966, - 2614053317, - 3297860332, - 3670298840, - 3732709413, - 3788324110, - 4098876453, - 4290374884, - 1623013158, - 3381478137, - 17185761, - 3931288033, - 2890638791, - 330388453, - 346929928, - 2022347217, - 4083347580, - 533021259, - 564302770, - 1917602962, - 680157484, - 3264086791, - 3727034815, - 798549062, - 3068463300, - 669812542, - 1965902997, - 2311072371, - 3079287749, - 2542834724, - 1587730355, - 2558655180, - 1838763297, - 4172568578, - 2160380860, - 2950446516, - 1830851200, - 3214537066, - 3234673086, - 3652695478, - 3103302036, - 3465954368, - 4180570743, - 3534518722, - 371186900, - 4091394002, - 1013756921, - 443558693, - 591140762, - 656610661, - 2064733527, - 3808408202, - 983299427, - 4217306348, - 1164218401, - 2036361232, - 3237903670, - 2970183398, - 2293637521, - 135920445, - 1596005536, - 868652905, - 1191735827, - 3987079331, - 1365842164, - 1508074873, - 1642818143, - 3436143898, - 4105051793, - 1863199739, - 3425841570, - 1070791291, - 2135340676, - 2639720559, - 3364388739, - 3797761273, - 2092100514, - 2098706974, - 2329992200, - 414444763, - 2759250216, - 2913136690, - 3012980338, - 3327770644, - 4128942283, - 3362344229, - 161668409, - 3401762422, - 2852854788, - 4237092412, - 1245448751, - 3702405475, - 918849409, - 3829682756, - 1612361408, - 255302575, - 414620710, - 386293029, - 618761615, - 686024761, - 744062262, - 1502028603, - 1543798545, - 1641415225, - 1548121999, - 2257971049, - 2124837447, - 878733439, - 2340670452, - 2674090849, - 3118011750, - 2816338013, - 178571546, - 2841008029, - 3249261197, - 370232173, - 4092487128, - 3787567939, - 3898287302, - 4142016703, - 4285779501, - 30663912, - 151672195, - 180913835, - 3534235309, - 34183582, - 4083161638, - 651464351, - 1410311776, - 371621315, - 421602934, - 458937500, - 2710583246, - 712168842, - 730943059, - 1519723107, - 875212982, - 1247793383, - 4217322139, - 989813600, - 1057606514, - 3764662384, - 1443547269, - 3066811685, - 3598957382, - 1791427568, - 1171541710, - 3930727258, - 1473799048, - 1296054774, - 1747355813, - 765238787, - 2023008475, - 1190147516, - 2344328209, - 2495155989, - 2577859137, - 2857814560, - 3127329373, - 3296722158, - 2773229577, - 3376009661, - 3450001968, - 920941800, - 3526837441, - 3858973601, - 1702168830, - 4088613871, - 1464587427, - 223310468, - 388034151, - 2346547796, - 1663234329, - 1750829822, - 1967643923, - 2881302403, - 2278706468, - 2326990117, - 2511346984, - 3088785099, - 2616085763, - 3027500544, - 3417583519, - 4178218543, - 1412908157, - 797934924, - 3533637837, - 1449907751, - 3362830643, - 1451831482, - 2637935122, - 3070114915, - 3023287679, - 551924251, - 1669930486, - 46736908, - 2870852215, - 1120149824, - 2923708820, - 3887377256, - 3464197236, - 4241374559, - 527665290, - 996663016, - 885020215, - 1763758554, - 3059119137, - 2555315060, - 2762094724, - 2530899578, - 2770161927, - 2262137600, - 3547456240, - 858902117, - 1140367371, - 1215030156, - 443490822, - 294390719, - 3032677281, - 1917451875, - 4184019303, - 3277199633, - 1271484400, - 1297294717, - 3560552546, - 171494987, - 195244192, - 3002890475, - 1811839150, - 265392489, - 1461398554, - 3205759417, - 333855951, - 529068443, - 660038281, - 557400685, - 663341511, - 930804377, - 1922045399, - 716890919, - 162167595, - 1654776395, - 1779143013, - 1123617794, - 2984325996, - 1162789888, - 1318479490, - 1235468610, - 3561562003, - 1486207619, - 1551372768, - 1850331254, - 3255947500, - 1037370721, - 1989327599, - 2137526937, - 835638766, - 2269130237, - 1962162282, - 3244209297, - 2330636993, - 3095831808, - 1396344138, - 2603020391, - 3434076295, - 3280064277, - 2656211099, - 3335250889, - 2550961007, - 3510242586, - 3536471583, - 3950980241, - 4033586023, - 117250846, - 3088282680, - 4041974454, - 4244540017, - 1167160774, - 899320334, - 1200870684, - 1752686878, - 1906988301, - 3804101227, - 2575525651, - 2919787747, - 3508792859, - 3548535223, - 3783756895, - 3797961332, - 4043078107, - 3115038057, - 2313593054, - 49456560, - 592180731, - 1051471757, - 1097775533, - 706238670, - 877895868, - 1173092699, - 1461897718, - 1767704813, - 1770165905, - 1923453688, - 2212501241, - 2305269460, - 2488410748, - 3782099915, - 2844616706, - 3383007207, - 3392887901, - 504514034, - 3765247327, - 1000070091, - 3727494858, - 3657635382, - 3839047923, - 3886529747, - 4069720347, - 4164704452, - 342197850, - 3540244297, - 2513230733, - 4117704995, - 3367298820, - 2680283743, - 3119663365, - 3697738938, - 545363837, - 163402553, - 5908395, - 129135650, - 2289183712, - 200922300, - 761731755, - 894529125, - 1086964761, - 1168927492, - 2100052708, - 2438466459, - 3390051757, - 2498042266, - 2557754096, - 2600961503, - 487719832, - 703543228, - 2726532092, - 4199470013, - 3142155593, - 2550501832, - 4076840151, - 200553094, - 380957745, - 572905105, - 462664429, - 1466804584, - 330249537, - 2605012269, - 491456522, - 4126287524, - 502863753, - 952536201, - 3510682541, - 1137442027, - 1665981878, - 1761469971, - 3085467405, - 2045285083, - 796985462, - 3433956341, - 2217966239, - 2183547611, - 2279273489, - 1916983087, - 2348676810, - 2403632109, - 2409539315, - 545986953, - 176166202, - 2477389837, - 2573160348, - 2796513469, - 3972309363, - 528662843, - 1038982109, - 1125913837, - 1318081294, - 1417425499, - }; - return descriptors_with_coding_scheme; -} diff --git a/tools/stats/spirv_stats.cpp b/tools/stats/spirv_stats.cpp deleted file mode 100644 index 609a6c972..000000000 --- a/tools/stats/spirv_stats.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "tools/stats/spirv_stats.h" - -#include - -#include -#include -#include - -#include "source/diagnostic.h" -#include "source/enum_string_mapping.h" -#include "source/extensions.h" -#include "source/id_descriptor.h" -#include "source/instruction.h" -#include "source/opcode.h" -#include "source/operand.h" -#include "source/val/instruction.h" -#include "source/val/validate.h" -#include "source/val/validation_state.h" -#include "spirv-tools/libspirv.h" - -namespace spvtools { -namespace stats { -namespace { - -// Helper class for stats aggregation. Receives as in/out parameter. -// Constructs ValidationState and updates it by running validator for each -// instruction. -class StatsAggregator { - public: - StatsAggregator(SpirvStats* in_out_stats, const val::ValidationState_t* state) - : stats_(in_out_stats), vstate_(state) {} - - // Processes the instructions to collect stats. - void aggregate() { - const auto& instructions = vstate_->ordered_instructions(); - - ++stats_->version_hist[vstate_->version()]; - ++stats_->generator_hist[vstate_->generator()]; - - for (size_t i = 0; i < instructions.size(); ++i) { - const auto& inst = instructions[i]; - - ProcessOpcode(&inst, i); - ProcessCapability(&inst); - ProcessExtension(&inst); - ProcessConstant(&inst); - } - } - - // Collects OpCapability statistics. - void ProcessCapability(const val::Instruction* inst) { - if (inst->opcode() != SpvOpCapability) return; - const uint32_t capability = inst->word(inst->operands()[0].offset); - ++stats_->capability_hist[capability]; - } - - // Collects OpExtension statistics. - void ProcessExtension(const val::Instruction* inst) { - if (inst->opcode() != SpvOpExtension) return; - const std::string extension = GetExtensionString(&inst->c_inst()); - ++stats_->extension_hist[extension]; - } - - // Collects OpCode statistics. - void ProcessOpcode(const val::Instruction* inst, size_t idx) { - const SpvOp opcode = inst->opcode(); - ++stats_->opcode_hist[opcode]; - - if (idx == 0) return; - - --idx; - - const auto& instructions = vstate_->ordered_instructions(); - - auto step_it = stats_->opcode_markov_hist.begin(); - for (; step_it != stats_->opcode_markov_hist.end(); --idx, ++step_it) { - auto& hist = (*step_it)[instructions[idx].opcode()]; - ++hist[opcode]; - - if (idx == 0) break; - } - } - - // Collects OpConstant statistics. - void ProcessConstant(const val::Instruction* inst) { - if (inst->opcode() != SpvOpConstant) return; - - const uint32_t type_id = inst->GetOperandAs(0); - const auto type_decl_it = vstate_->all_definitions().find(type_id); - assert(type_decl_it != vstate_->all_definitions().end()); - - const val::Instruction& type_decl_inst = *type_decl_it->second; - const SpvOp type_op = type_decl_inst.opcode(); - if (type_op == SpvOpTypeInt) { - const uint32_t bit_width = type_decl_inst.GetOperandAs(1); - const uint32_t is_signed = type_decl_inst.GetOperandAs(2); - assert(is_signed == 0 || is_signed == 1); - if (bit_width == 16) { - if (is_signed) - ++stats_->s16_constant_hist[inst->GetOperandAs(2)]; - else - ++stats_->u16_constant_hist[inst->GetOperandAs(2)]; - } else if (bit_width == 32) { - if (is_signed) - ++stats_->s32_constant_hist[inst->GetOperandAs(2)]; - else - ++stats_->u32_constant_hist[inst->GetOperandAs(2)]; - } else if (bit_width == 64) { - if (is_signed) - ++stats_->s64_constant_hist[inst->GetOperandAs(2)]; - else - ++stats_->u64_constant_hist[inst->GetOperandAs(2)]; - } else { - assert(false && "TypeInt bit width is not 16, 32 or 64"); - } - } else if (type_op == SpvOpTypeFloat) { - const uint32_t bit_width = type_decl_inst.GetOperandAs(1); - if (bit_width == 32) { - ++stats_->f32_constant_hist[inst->GetOperandAs(2)]; - } else if (bit_width == 64) { - ++stats_->f64_constant_hist[inst->GetOperandAs(2)]; - } else { - assert(bit_width == 16); - } - } - } - - private: - SpirvStats* stats_; - const val::ValidationState_t* vstate_; - IdDescriptorCollection id_descriptors_; -}; - -} // namespace - -spv_result_t AggregateStats(const spv_context context, const uint32_t* words, - const size_t num_words, spv_diagnostic* pDiagnostic, - SpirvStats* stats) { - std::unique_ptr vstate; - spv_validator_options_t options; - spv_result_t result = ValidateBinaryAndKeepValidationState( - context, &options, words, num_words, pDiagnostic, &vstate); - if (result != SPV_SUCCESS) return result; - - StatsAggregator stats_aggregator(stats, vstate.get()); - stats_aggregator.aggregate(); - return SPV_SUCCESS; -} - -} // namespace stats -} // namespace spvtools diff --git a/tools/stats/spirv_stats.h b/tools/stats/spirv_stats.h deleted file mode 100644 index 757695775..000000000 --- a/tools/stats/spirv_stats.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef TOOLS_STATS_SPIRV_STATS_H_ -#define TOOLS_STATS_SPIRV_STATS_H_ - -#include -#include -#include -#include -#include - -#include "spirv-tools/libspirv.hpp" - -namespace spvtools { -namespace stats { - -struct SpirvStats { - // Version histogram, version_word -> count. - std::unordered_map version_hist; - - // Generator histogram, generator_word -> count. - std::unordered_map generator_hist; - - // Capability histogram, SpvCapabilityXXX -> count. - std::unordered_map capability_hist; - - // Extension histogram, extension_string -> count. - std::unordered_map extension_hist; - - // Opcode histogram, SpvOpXXX -> count. - std::unordered_map opcode_hist; - - // OpConstant u16 histogram, value -> count. - std::unordered_map u16_constant_hist; - - // OpConstant u32 histogram, value -> count. - std::unordered_map u32_constant_hist; - - // OpConstant u64 histogram, value -> count. - std::unordered_map u64_constant_hist; - - // OpConstant s16 histogram, value -> count. - std::unordered_map s16_constant_hist; - - // OpConstant s32 histogram, value -> count. - std::unordered_map s32_constant_hist; - - // OpConstant s64 histogram, value -> count. - std::unordered_map s64_constant_hist; - - // OpConstant f32 histogram, value -> count. - std::unordered_map f32_constant_hist; - - // OpConstant f64 histogram, value -> count. - std::unordered_map f64_constant_hist; - - // Used to collect statistics on opcodes triggering other opcodes. - // Container scheme: gap between instructions -> cue opcode -> later opcode - // -> count. - // For example opcode_markov_hist[2][OpFMul][OpFAdd] corresponds to - // the number of times an OpMul appears, followed by 2 other instructions, - // followed by OpFAdd. - // opcode_markov_hist[0][OpFMul][OpFAdd] corresponds to how many times - // OpFMul appears, directly followed by OpFAdd. - // The size of the outer std::vector also serves as an input parameter, - // determining how many steps will be collected. - // I.e. do opcode_markov_hist.resize(1) to collect data for one step only. - std::vector< - std::unordered_map>> - opcode_markov_hist; -}; - -// Aggregates existing |stats| with new stats extracted from |binary|. -spv_result_t AggregateStats(const spv_context context, const uint32_t* words, - const size_t num_words, spv_diagnostic* pDiagnostic, - SpirvStats* stats); - -} // namespace stats -} // namespace spvtools - -#endif // TOOLS_STATS_SPIRV_STATS_H_ diff --git a/tools/stats/stats.cpp b/tools/stats/stats.cpp deleted file mode 100644 index 30e3bccd6..000000000 --- a/tools/stats/stats.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include - -#include "spirv-tools/libspirv.h" -#include "tools/io.h" -#include "tools/stats/spirv_stats.h" -#include "tools/stats/stats_analyzer.h" - -namespace { - -void PrintUsage(char* argv0) { - printf( - R"(%s - Collect statistics from one or more SPIR-V binary file(s). - -USAGE: %s [options] [] - -TIP: In order to collect statistics from all .spv files under current dir use -find . -name "*.spv" -print0 | xargs -0 -s 2000000 %s - -Options: - -h, --help - Print this help. - - -v, --verbose - Print additional info to stderr. -)", - argv0, argv0, argv0); -} - -void DiagnosticsMessageHandler(spv_message_level_t level, const char*, - const spv_position_t& position, - const char* message) { - switch (level) { - case SPV_MSG_FATAL: - case SPV_MSG_INTERNAL_ERROR: - case SPV_MSG_ERROR: - std::cerr << "error: " << position.index << ": " << message << std::endl; - break; - case SPV_MSG_WARNING: - std::cout << "warning: " << position.index << ": " << message - << std::endl; - break; - case SPV_MSG_INFO: - std::cout << "info: " << position.index << ": " << message << std::endl; - break; - default: - break; - } -} - -} // namespace - -int main(int argc, char** argv) { - bool continue_processing = true; - int return_code = 0; - - bool expect_output_path = false; - bool verbose = false; - - std::vector paths; - const char* output_path = nullptr; - - for (int argi = 1; continue_processing && argi < argc; ++argi) { - const char* cur_arg = argv[argi]; - if ('-' == cur_arg[0]) { - if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { - PrintUsage(argv[0]); - continue_processing = false; - return_code = 0; - } else if (0 == strcmp(cur_arg, "--verbose") || - 0 == strcmp(cur_arg, "-v")) { - verbose = true; - } else if (0 == strcmp(cur_arg, "--output") || - 0 == strcmp(cur_arg, "-o")) { - expect_output_path = true; - } else { - PrintUsage(argv[0]); - continue_processing = false; - return_code = 1; - } - } else { - if (expect_output_path) { - output_path = cur_arg; - expect_output_path = false; - } else { - paths.push_back(cur_arg); - } - } - } - - // Exit if command line parsing was not successful. - if (!continue_processing) { - return return_code; - } - - std::cerr << "Processing " << paths.size() << " files..." << std::endl; - - spvtools::Context ctx(SPV_ENV_UNIVERSAL_1_1); - ctx.SetMessageConsumer(DiagnosticsMessageHandler); - - spvtools::stats::SpirvStats stats; - stats.opcode_markov_hist.resize(1); - - for (size_t index = 0; index < paths.size(); ++index) { - const size_t kMilestonePeriod = 1000; - if (verbose) { - if (index % kMilestonePeriod == kMilestonePeriod - 1) - std::cerr << "Processed " << index + 1 << " files..." << std::endl; - } - - const char* path = paths[index]; - std::vector contents; - if (!ReadFile(path, "rb", &contents)) return 1; - - if (SPV_SUCCESS != - spvtools::stats::AggregateStats(ctx.CContext(), contents.data(), - contents.size(), nullptr, &stats)) { - std::cerr << "error: Failed to aggregate stats for " << path << std::endl; - return 1; - } - } - - spvtools::stats::StatsAnalyzer analyzer(stats); - - std::ofstream fout; - if (output_path) { - fout.open(output_path); - if (!fout.is_open()) { - std::cerr << "error: Failed to open " << output_path << std::endl; - return 1; - } - } - - std::ostream& out = fout.is_open() ? fout : std::cout; - out << std::endl; - analyzer.WriteVersion(out); - analyzer.WriteGenerator(out); - - out << std::endl; - analyzer.WriteCapability(out); - - out << std::endl; - analyzer.WriteExtension(out); - - out << std::endl; - analyzer.WriteOpcode(out); - - out << std::endl; - analyzer.WriteOpcodeMarkov(out); - - out << std::endl; - analyzer.WriteConstantLiterals(out); - - return 0; -} diff --git a/tools/stats/stats_analyzer.cpp b/tools/stats/stats_analyzer.cpp deleted file mode 100644 index 6d4cabbf6..000000000 --- a/tools/stats/stats_analyzer.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "tools/stats/stats_analyzer.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "source/comp/markv_model.h" -#include "source/enum_string_mapping.h" -#include "source/latest_version_spirv_header.h" -#include "source/opcode.h" -#include "source/operand.h" -#include "source/spirv_constant.h" - -namespace spvtools { -namespace stats { -namespace { - -// Signals that the value is not in the coding scheme and a fallback method -// needs to be used. -const uint64_t kMarkvNoneOfTheAbove = - comp::MarkvModel::GetMarkvNoneOfTheAbove(); - -std::string GetVersionString(uint32_t word) { - std::stringstream ss; - ss << "Version " << SPV_SPIRV_VERSION_MAJOR_PART(word) << "." - << SPV_SPIRV_VERSION_MINOR_PART(word); - return ss.str(); -} - -std::string GetGeneratorString(uint32_t word) { - return spvGeneratorStr(SPV_GENERATOR_TOOL_PART(word)); -} - -std::string GetOpcodeString(uint32_t word) { - return spvOpcodeString(static_cast(word)); -} - -std::string GetCapabilityString(uint32_t word) { - return CapabilityToString(static_cast(word)); -} - -template -std::string KeyIsLabel(T key) { - std::stringstream ss; - ss << key; - return ss.str(); -} - -template -std::unordered_map GetRecall( - const std::unordered_map& hist, uint64_t total) { - std::unordered_map freq; - for (const auto& pair : hist) { - const double frequency = - static_cast(pair.second) / static_cast(total); - freq.emplace(pair.first, frequency); - } - return freq; -} - -template -std::unordered_map GetPrevalence( - const std::unordered_map& hist) { - uint64_t total = 0; - for (const auto& pair : hist) { - total += pair.second; - } - - return GetRecall(hist, total); -} - -// Writes |freq| to |out| sorted by frequency in the following format: -// LABEL3 70% -// LABEL1 20% -// LABEL2 10% -// |label_from_key| is used to convert |Key| to label. -template -void WriteFreq(std::ostream& out, const std::unordered_map& freq, - std::string (*label_from_key)(Key)) { - std::vector> sorted_freq(freq.begin(), freq.end()); - std::sort(sorted_freq.begin(), sorted_freq.end(), - [](const std::pair& left, - const std::pair& right) { - return left.second > right.second; - }); - - for (const auto& pair : sorted_freq) { - if (pair.second < 0.001) break; - out << label_from_key(pair.first) << " " << pair.second * 100.0 << "%" - << std::endl; - } -} - -} // namespace - -StatsAnalyzer::StatsAnalyzer(const SpirvStats& stats) : stats_(stats) { - num_modules_ = 0; - for (const auto& pair : stats_.version_hist) { - num_modules_ += pair.second; - } - - version_freq_ = GetRecall(stats_.version_hist, num_modules_); - generator_freq_ = GetRecall(stats_.generator_hist, num_modules_); - capability_freq_ = GetRecall(stats_.capability_hist, num_modules_); - extension_freq_ = GetRecall(stats_.extension_hist, num_modules_); - opcode_freq_ = GetPrevalence(stats_.opcode_hist); -} - -void StatsAnalyzer::WriteVersion(std::ostream& out) { - WriteFreq(out, version_freq_, GetVersionString); -} - -void StatsAnalyzer::WriteGenerator(std::ostream& out) { - WriteFreq(out, generator_freq_, GetGeneratorString); -} - -void StatsAnalyzer::WriteCapability(std::ostream& out) { - WriteFreq(out, capability_freq_, GetCapabilityString); -} - -void StatsAnalyzer::WriteExtension(std::ostream& out) { - WriteFreq(out, extension_freq_, KeyIsLabel); -} - -void StatsAnalyzer::WriteOpcode(std::ostream& out) { - out << "Total unique opcodes used: " << opcode_freq_.size() << std::endl; - WriteFreq(out, opcode_freq_, GetOpcodeString); -} - -void StatsAnalyzer::WriteConstantLiterals(std::ostream& out) { - out << "Constant literals" << std::endl; - - out << "Float 32" << std::endl; - WriteFreq(out, GetPrevalence(stats_.f32_constant_hist), KeyIsLabel); - - out << std::endl << "Float 64" << std::endl; - WriteFreq(out, GetPrevalence(stats_.f64_constant_hist), KeyIsLabel); - - out << std::endl << "Unsigned int 16" << std::endl; - WriteFreq(out, GetPrevalence(stats_.u16_constant_hist), KeyIsLabel); - - out << std::endl << "Signed int 16" << std::endl; - WriteFreq(out, GetPrevalence(stats_.s16_constant_hist), KeyIsLabel); - - out << std::endl << "Unsigned int 32" << std::endl; - WriteFreq(out, GetPrevalence(stats_.u32_constant_hist), KeyIsLabel); - - out << std::endl << "Signed int 32" << std::endl; - WriteFreq(out, GetPrevalence(stats_.s32_constant_hist), KeyIsLabel); - - out << std::endl << "Unsigned int 64" << std::endl; - WriteFreq(out, GetPrevalence(stats_.u64_constant_hist), KeyIsLabel); - - out << std::endl << "Signed int 64" << std::endl; - WriteFreq(out, GetPrevalence(stats_.s64_constant_hist), KeyIsLabel); -} - -void StatsAnalyzer::WriteOpcodeMarkov(std::ostream& out) { - if (stats_.opcode_markov_hist.empty()) return; - - const std::unordered_map>& - cue_to_hist = stats_.opcode_markov_hist[0]; - - // Sort by prevalence of the opcodes in opcode_freq_ (descending). - std::vector>> - sorted_cue_to_hist(cue_to_hist.begin(), cue_to_hist.end()); - std::sort( - sorted_cue_to_hist.begin(), sorted_cue_to_hist.end(), - [this](const std::pair>& - left, - const std::pair>& - right) { - const double lf = opcode_freq_[left.first]; - const double rf = opcode_freq_[right.first]; - if (lf == rf) return right.first > left.first; - return lf > rf; - }); - - for (const auto& kv : sorted_cue_to_hist) { - const uint32_t cue = kv.first; - const double kFrequentEnoughToAnalyze = 0.0001; - if (opcode_freq_[cue] < kFrequentEnoughToAnalyze) continue; - - const std::unordered_map& hist = kv.second; - - uint32_t total = 0; - for (const auto& pair : hist) { - total += pair.second; - } - - std::vector> sorted_hist(hist.begin(), - hist.end()); - std::sort(sorted_hist.begin(), sorted_hist.end(), - [](const std::pair& left, - const std::pair& right) { - if (left.second == right.second) - return right.first > left.first; - return left.second > right.second; - }); - - for (const auto& pair : sorted_hist) { - const double prior = opcode_freq_[pair.first]; - const double posterior = - static_cast(pair.second) / static_cast(total); - out << GetOpcodeString(cue) << " -> " << GetOpcodeString(pair.first) - << " " << posterior * 100 << "% (base rate " << prior * 100 - << "%, pair occurrences " << pair.second << ")" << std::endl; - } - } -} - -} // namespace stats -} // namespace spvtools diff --git a/tools/stats/stats_analyzer.h b/tools/stats/stats_analyzer.h deleted file mode 100644 index f1c37bfaa..000000000 --- a/tools/stats/stats_analyzer.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef TOOLS_STATS_STATS_ANALYZER_H_ -#define TOOLS_STATS_STATS_ANALYZER_H_ - -#include -#include - -#include "tools/stats/spirv_stats.h" - -namespace spvtools { -namespace stats { - -class StatsAnalyzer { - public: - explicit StatsAnalyzer(const SpirvStats& stats); - - // Writes respective histograms to |out|. - void WriteVersion(std::ostream& out); - void WriteGenerator(std::ostream& out); - void WriteCapability(std::ostream& out); - void WriteExtension(std::ostream& out); - void WriteOpcode(std::ostream& out); - void WriteConstantLiterals(std::ostream& out); - - // Writes first order Markov analysis to |out|. - // stats_.opcode_markov_hist needs to contain raw data for at least one - // level. - void WriteOpcodeMarkov(std::ostream& out); - - private: - const SpirvStats& stats_; - - uint32_t num_modules_; - - std::unordered_map version_freq_; - std::unordered_map generator_freq_; - std::unordered_map capability_freq_; - std::unordered_map extension_freq_; - std::unordered_map opcode_freq_; -}; - -} // namespace stats -} // namespace spvtools - -#endif // TOOLS_STATS_STATS_ANALYZER_H_