Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need a C++ API #2

Closed
dneto0 opened this issue Nov 14, 2015 · 2 comments
Closed

need a C++ API #2

dneto0 opened this issue Nov 14, 2015 · 2 comments

Comments

@dneto0
Copy link
Collaborator

dneto0 commented Nov 14, 2015

The SPIR-V Tools API is a C API to provide ABI stability and a lowest-common-denominator target for multiple languages. However, it's begging for a more convenient C++ API.

@antiagainst
Copy link
Contributor

+1

a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue Sep 19, 2016
… specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)
@antiagainst
Copy link
Contributor

This is done via #410 & #411.

s-perron added a commit that referenced this issue Feb 23, 2018
In some shaders there are a lot of very large and deeply nested
structures.  This creates a lot of work for scalar replacement.  Also,
since commit ca4457b we have been very aggressive as rewriting
variables.  This has causes a large increase in compile time in creating
and then deleting the instructions.

To help low the costs, I want to run a cleanup of some of the easy loads
and stores to remove.  This reduces the number of symbols sroa has to
work on.  It also reduces the amount of code the simplifier has to
simplify because it was not generated by sroa.

To confirm the improvement, I ran numbers on three different sets of
shaders:

Time to run --legalize-hlsl:

Set #1: 55.89s -> 12.0s
Set #2: 1m44s -> 1m40.5s
Set #3: 6.8s -> 5.7s

Time to run -O

Set #1: 18.8s -> 10.9s
Set #2: 5m44s -> 4m17s
Set #3: 7.8s -> 7.8s

Contributes to #1328.
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue May 12, 2019
… specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)
jaebaek added a commit to jaebaek/SPIRV-Tools that referenced this issue Oct 15, 2020
`DebugInfoManager::AddDebugValueIfVarDeclIsVisible()` adds
OpenCL.DebugInfo.100 DebugValue from DebugDeclare only when the
DebugDeclare is visible to the give scope. It helps us correctly
handle a reference variable e.g.,

{ // scope KhronosGroup#1.
  int foo = /* init */;
  { // scope KhronosGroup#2.
    int& bar = foo;
    ...

in the above code, we must not propagate DebugValue of `int& bar` for
store instructions in the scope KhronosGroup#1 because it is alive only in
the scope KhronosGroup#2.

We have an exception: If the given DebugDeclare is used for a function
parameter, `DebugInfoManager::AddDebugValueIfVarDeclIsVisible()` has
to always add DebugValue instruction regardless
of the scope. It is because the initializer (store instruction) for
the function parameter can be out of the function parameter's scope
(the function) in particular when the function was inlined.

Without this change, the function parameter value information always
disappears whenever we run the function inlining pass and
`DebugInfoManager::AddDebugValueIfVarDeclIsVisible()`.
jaebaek added a commit that referenced this issue Oct 16, 2020
`DebugInfoManager::AddDebugValueIfVarDeclIsVisible()` adds
OpenCL.DebugInfo.100 DebugValue from DebugDeclare only when the
DebugDeclare is visible to the give scope. It helps us correctly
handle a reference variable e.g.,

{ // scope #1.
  int foo = /* init */;
  { // scope #2.
    int& bar = foo;
    ...

in the above code, we must not propagate DebugValue of `int& bar` for
store instructions in the scope #1 because it is alive only in
the scope #2.

We have an exception: If the given DebugDeclare is used for a function
parameter, `DebugInfoManager::AddDebugValueIfVarDeclIsVisible()` has
to always add DebugValue instruction regardless
of the scope. It is because the initializer (store instruction) for
the function parameter can be out of the function parameter's scope
(the function) in particular when the function was inlined.

Without this change, the function parameter value information always
disappears whenever we run the function inlining pass and
`DebugInfoManager::AddDebugValueIfVarDeclIsVisible()`.
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue Dec 27, 2020
… specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue Oct 13, 2021
… specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue Oct 5, 2022
 * allow building on FreeBSD (pretend it's Linux)

 * added spirv_container: this implements a simple SPIR-V container format that can be used to easily bundle multiple SPIR-V modules in a single file. Alternatively, it can also wrap a singular SPIR-V binary, thus providing the same interface for both file types.
 * make use of spirv_container in spirv-dis (output everything to a single file or stdout), spirv-val (fails/returns on the first module error) and spirv-cfg (output multiple .dot files, or everything to stdout)

 * initial debug-asm commit: this disassembly output mode/format is solely intended as a read-only debugging aid that has more human-friendly formatting (-> this will _not_ reassemble into a SPIR-V binary)
 * added DebugNameMapper, which inherits from and extends FriendlyNameMapper: type names are more C/LLVM like with this and constants are assigned their value as a name (e.g. %42u for a 32-bit uint constant with value 42), will also figure out the maximum name length that is generated/used in the module
 * modified Disassembler, when using debug-asm:
   * all text will be centered on and align to the "=" (will add padding on the lhs for all names < max name length)
   * function and label printing will be more C/LLVM like (will have a proper function header, body is wrapped in {}, labels are written directly on the left)
   * OpPhi has nicer printing (id <- label, ...)
   * OpName / OpMemberName opcodes are skipped, because proper names will already be printed with FriendlyNameMapper
   * red text is used instead of blue text for lhs result ids (easier to read on black/transparent backgrounds, also works on white)
   * "Op" part of opcode names is skipped (we know these are opcodes)
 * also get rid of "gl_" builtin naming while I'm at it (some of these are used for OpenCL as well and SPIR-V is essentially language-agnostic)

 * debug-asm part KhronosGroup#2: will now (lazily) load source files specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)

 * actually do the invalid line/column number checking properly

 * fixed gcc warning/error

 * post-rebase fixes

 * cmake: disable python 3 requirement if we don't build tests anyways

 * post-rebase fixes 20201227

 * use "debug ASM" mode when printing a validator error

 * spirv_container: added support for rudimentary container/module metadata (function names + types), added supporting for writing a container

 * opt: added initial container support

 * added missing headers

 * post-rebase fixes 20221006
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue Dec 29, 2022
 * allow building on FreeBSD (pretend it's Linux)

 * added spirv_container: this implements a simple SPIR-V container format that can be used to easily bundle multiple SPIR-V modules in a single file. Alternatively, it can also wrap a singular SPIR-V binary, thus providing the same interface for both file types.
 * make use of spirv_container in spirv-dis (output everything to a single file or stdout), spirv-val (fails/returns on the first module error) and spirv-cfg (output multiple .dot files, or everything to stdout)

 * initial debug-asm commit: this disassembly output mode/format is solely intended as a read-only debugging aid that has more human-friendly formatting (-> this will _not_ reassemble into a SPIR-V binary)
 * added DebugNameMapper, which inherits from and extends FriendlyNameMapper: type names are more C/LLVM like with this and constants are assigned their value as a name (e.g. %42u for a 32-bit uint constant with value 42), will also figure out the maximum name length that is generated/used in the module
 * modified Disassembler, when using debug-asm:
   * all text will be centered on and align to the "=" (will add padding on the lhs for all names < max name length)
   * function and label printing will be more C/LLVM like (will have a proper function header, body is wrapped in {}, labels are written directly on the left)
   * OpPhi has nicer printing (id <- label, ...)
   * OpName / OpMemberName opcodes are skipped, because proper names will already be printed with FriendlyNameMapper
   * red text is used instead of blue text for lhs result ids (easier to read on black/transparent backgrounds, also works on white)
   * "Op" part of opcode names is skipped (we know these are opcodes)
 * also get rid of "gl_" builtin naming while I'm at it (some of these are used for OpenCL as well and SPIR-V is essentially language-agnostic)

 * debug-asm part KhronosGroup#2: will now (lazily) load source files specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)

 * actually do the invalid line/column number checking properly

 * fixed gcc warning/error

 * post-rebase fixes

 * cmake: disable python 3 requirement if we don't build tests anyways

 * post-rebase fixes 20201227

 * use "debug ASM" mode when printing a validator error

 * spirv_container: added support for rudimentary container/module metadata (function names + types), added supporting for writing a container

 * opt: added initial container support

 * added missing headers

 * post-rebase fixes 20221006, 20221229
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue May 7, 2023
 * allow building on FreeBSD (pretend it's Linux)

 * added spirv_container: this implements a simple SPIR-V container format that can be used to easily bundle multiple SPIR-V modules in a single file. Alternatively, it can also wrap a singular SPIR-V binary, thus providing the same interface for both file types.
 * make use of spirv_container in spirv-dis (output everything to a single file or stdout), spirv-val (fails/returns on the first module error) and spirv-cfg (output multiple .dot files, or everything to stdout)

 * initial debug-asm commit: this disassembly output mode/format is solely intended as a read-only debugging aid that has more human-friendly formatting (-> this will _not_ reassemble into a SPIR-V binary)
 * added DebugNameMapper, which inherits from and extends FriendlyNameMapper: type names are more C/LLVM like with this and constants are assigned their value as a name (e.g. %42u for a 32-bit uint constant with value 42), will also figure out the maximum name length that is generated/used in the module
 * modified Disassembler, when using debug-asm:
   * all text will be centered on and align to the "=" (will add padding on the lhs for all names < max name length)
   * function and label printing will be more C/LLVM like (will have a proper function header, body is wrapped in {}, labels are written directly on the left)
   * OpPhi has nicer printing (id <- label, ...)
   * OpName / OpMemberName opcodes are skipped, because proper names will already be printed with FriendlyNameMapper
   * red text is used instead of blue text for lhs result ids (easier to read on black/transparent backgrounds, also works on white)
   * "Op" part of opcode names is skipped (we know these are opcodes)
 * also get rid of "gl_" builtin naming while I'm at it (some of these are used for OpenCL as well and SPIR-V is essentially language-agnostic)

 * debug-asm part KhronosGroup#2: will now (lazily) load source files specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)

 * actually do the invalid line/column number checking properly

 * fixed gcc warning/error

 * post-rebase fixes

 * cmake: disable python 3 requirement if we don't build tests anyways

 * post-rebase fixes 20201227

 * use "debug ASM" mode when printing a validator error

 * spirv_container: added support for rudimentary container/module metadata (function names + types), added supporting for writing a container

 * opt: added initial container support

 * added missing headers

 * validation_state: added support for printing more than one instruction in a diagnostic message
 * validate_cfg/validate_memory: make use of this in several diag calls (mainly cfg structurization issues)
 * debug_name_mapper: allow '=' and '!' characters
 * disassemble: set the max possible indentation to 160 chars

 * post-rebase fixes 20221006, 20221229, 20230507
a2flo added a commit to a2flo/SPIRV-Tools that referenced this issue Mar 17, 2024
 * allow building on FreeBSD (pretend it's Linux)

 * added spirv_container: this implements a simple SPIR-V container format that can be used to easily bundle multiple SPIR-V modules in a single file. Alternatively, it can also wrap a singular SPIR-V binary, thus providing the same interface for both file types.
 * make use of spirv_container in spirv-dis (output everything to a single file or stdout), spirv-val (fails/returns on the first module error) and spirv-cfg (output multiple .dot files, or everything to stdout)

 * initial debug-asm commit: this disassembly output mode/format is solely intended as a read-only debugging aid that has more human-friendly formatting (-> this will _not_ reassemble into a SPIR-V binary)
 * added DebugNameMapper, which inherits from and extends FriendlyNameMapper: type names are more C/LLVM like with this and constants are assigned their value as a name (e.g. %42u for a 32-bit uint constant with value 42), will also figure out the maximum name length that is generated/used in the module
 * modified Disassembler, when using debug-asm:
   * all text will be centered on and align to the "=" (will add padding on the lhs for all names < max name length)
   * function and label printing will be more C/LLVM like (will have a proper function header, body is wrapped in {}, labels are written directly on the left)
   * OpPhi has nicer printing (id <- label, ...)
   * OpName / OpMemberName opcodes are skipped, because proper names will already be printed with FriendlyNameMapper
   * red text is used instead of blue text for lhs result ids (easier to read on black/transparent backgrounds, also works on white)
   * "Op" part of opcode names is skipped (we know these are opcodes)
 * also get rid of "gl_" builtin naming while I'm at it (some of these are used for OpenCL as well and SPIR-V is essentially language-agnostic)

 * debug-asm part KhronosGroup#2: will now (lazily) load source files specified in OpString and print inline source code + column marker for each OpLine (and won't repeat identical OpLines)

 * actually do the invalid line/column number checking properly

 * fixed gcc warning/error

 * post-rebase fixes

 * cmake: disable python 3 requirement if we don't build tests anyways

 * post-rebase fixes 20201227

 * use "debug ASM" mode when printing a validator error

 * spirv_container: added support for rudimentary container/module metadata (function names + types), added supporting for writing a container

 * opt: added initial container support

 * added missing headers

 * validation_state: added support for printing more than one instruction in a diagnostic message
 * validate_cfg/validate_memory: make use of this in several diag calls (mainly cfg structurization issues)
 * debug_name_mapper: allow '=' and '!' characters
 * disassemble: set the max possible indentation to 160 chars

 * post-rebase fixes 20221006, 20221229, 20230507, 20240317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants