commit | 0f166be68d4b6624a10d6bf312679505d391ec22 | [log] [tgz] |
---|---|---|
author | David Neto <dneto@google.com> | Wed Nov 11 01:56:49 2015 -0500 |
committer | David Neto <dneto@google.com> | Wed Nov 11 12:12:04 2015 -0500 |
tree | e628cbbb9f31bff2be4cf8a36f5bc9f0d3f5aff4 | |
parent | ce9cef71ac288f8b1c53ba7b8be600cb756329d4 [diff] |
Assembler support for OpSpecConstantOp Adds SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER.
The project includes an assembler, disassembler, and validator for SPIR-V, all based on a common static library. The library contains all of the implementation details and is used in the standalone tools whilst also enabling integration into other code bases directly.
OpConstant
, OpSpecConstant
, and OpSwitch
.The validator is incomplete. See the Future Work section for more information.
2015-11-10
spv_operand_type_t
into concrete, optional, and variable groups.2015-11-02
libspirv.h
a C API:spirv.h
instead of C++ header spirv.hpp
2015-10-16
syntax.md
.OpConstant
, OpSpecConstant
, and OpSwitch
are type- and range-checked. The assembler checks that other literal numbers are non-negative integers. That's the grammar works, at least for now.2015-10-02
!<integer>
syntax to inject arbitrary words into the binary. This feature is used for testing.2015-09-25
%
prefix before the name._
).%2
could accidentally map to the same numeric ID as named ID %foo
.%2
doesn't necessarily map to ID 2.2015-09-18
syntax.md
for more.!<number>
syntax. Still incomplete.2015-09-15
Aligned
memory access flag takes a literal number operand.2015-09-11
2015-09-09
spv_binary
is only used for output of the assembler, and should always be destroyed with spvBinaryDestroy
.spv_text
is only used for output of the disassembler, and should always be destroyed with spvTextDestroy
.2015-09-04
spv_operand_pattern_t
.clang-format --style=google
.spv_binary_t
and spv_text_t
objects.The master
branch of the repository is maintained by Kenneth Benzie k.benzie@codeplay.com
.
Please submit any merge requests as stated in these instructions.
The project uses CMake to generate platform-specific build configurations. To generate these build files issue the following commands.
mkdir <spirv-dir>/build cd <spirv-dir>/build cmake [-G<platform-generator>] ..
Once the build files have been generated, build using your preferred development environment.
SPIRV_USE_SANITIZER=<sanitizer>
- on UNIX platforms with an appropriate version of clang
this option enables the use of the sanitizers documented here, this should only be used with a debug build, disabled by defaultSPIRV_COLOR_TERMINAL=ON
- enables color console output, enabled by defaultSPIRV_WARN_EVERYTHING=OFF
- on UNIX platforms enable the -Weverything
compiler front end option, disabled by defaultSPIRV_WERROR=OFF
- on UNIX platforms enable the -Werror
compiler front end option, disabled by defaultIn order to use the library from an application, the include path should point to <spirv-dir>/include
, which will enable the application to include the header <spirv-dir>/include/libspirv/libspirv.h
then linking against the static library in <spirv-build-dir>/bin/libSPIRV.a
or <spirv-build-dir>/bin/SPIRV.lib
. The intention is for this to be a C API, however currently it relies on the generated header spirv.h
meaning this is currently a C++ API.
SPIRV
- the static library CMake target outputs <spirv-dir>/lib/libSPIRV.a
on Linux/Mac or <spirv-dir>/lib/SPIRV.lib
on Windows.There are three main entry points into the library.
spvTextToBinary
implements the assembler functionality.spvBinaryToText
implements the disassembler functionality.spvValidate
implements the validator functionality.In addition to the interface header <spirv-dir>/include/libspirv/libspirv.h
the implementation source files reside in <spirv-dir>/source/*
.
The parsers for the assembler and disassembler use a table describing the syntax of each core instruction. This table can be generated from the SPIR-V document generator:
source/core_syntax_table.patch
to the document generator.-a
option and place the results in the opcode.inc
file in the SPIR-V Tools source
directory.The standalone assembler is the binary called spirv-as
and is located in <spirv-build-dir>/bin/spirv-as
. The functionality of the assembler is implemented by the spvTextToBinary
library function.
The assembler operates on the textual form.
spirv-as
- the standalone assembler<spirv-dir>/bin/spirv-as
-o <filename>
is used to specify the output file, otherwise this is set to out.spv
.See syntax.md
for the assembly language syntax.
The standalone disassembler is the binary called spirv-dis
and is located in <spirv-build-dir>/bin/spirv-dis
. The functionality of the disassembler is implemented by the spvBinaryToText
library function.
The disassembler operates on the binary form.
spirv-dis
- the standalone disassembler<spirv-dir>/bin/spirv-dis
-o <filename>
is used to specify the output file, otherwise this is set to out.spvasm
.-p
prints the assembly to the console on stdout, this includes colored output on Linux, Windows, and Mac.The standalone validator is the binary called spirv-val
and is located in <spirv-build-dir>/bin/spirv-val
. The functionality of the validator is implemented by the spvValidate
library function.
The validator operates on the binary form.
spirv-val
- the standalone validator<spirv-dir>/bin/spirv-val
-basic
performs basic stream validation, currently not implemented.-layout
performs logical layout validation as described in section 2.16 Validation Rules, currently not implemented.-id
performs ID validation according to the instruction rules in sections 3.28.1 through 3.28.22, enabled but is a work in progress.-capability
performs capability validation and or reporting, currently not implemented.The project contains a number of tests, implemented in the UnitSPIRV
executable, used to drive the development and correctness of the tools, these use the googletest framework. The googletest source is not provided with this project, to enable the tests place the googletest source in the <spirv-dir>/external/googletest
directory, rerun CMake if you have already done so previously, CMake will detect the existence of <spirv-dir>/external/googletest
then build as normal.
spirv-val
.spirv-val
.spirv-val
.spirv-dis
.libspirv.h
cannot be used in C code.Copyright (c) 2015 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.