Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Also, the version was bumped to 0.2.1 (from 0.2.0) due to the changes.
Fix: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/15
|
|
The project version was also changed as the entrypoints to the library
have been modified.
Command used:
/usr/share/clang/run-clang-tidy.py -header-filter "(./include/SPIRV.h|./lib/SPIRV/Mangler/FunctionDescriptor.h|./lib/SPIRV/Mangler/ManglingUtils.h|./lib/SPIRV/Mangler/NameMangleAPI.h|./lib/SPIRV/Mangler/ParameterType.h|./lib/SPIRV/Mangler/Refcount.h|./lib/SPIRV/libSPIRV/libSPIRV.h|./lib/SPIRV/libSPIRV/SPIRVBasicBlock.h|./lib/SPIRV/libSPIRV/SPIRVDebug.h|./lib/SPIRV/libSPIRV/SPIRVDecorate.h|./lib/SPIRV/libSPIRV/SPIRVEntry.h|./lib/SPIRV/libSPIRV/SPIRVEnum.h|./lib/SPIRV/libSPIRV/SPIRVError.h|./lib/SPIRV/libSPIRV/SPIRVErrorEnum.h|./lib/SPIRV/libSPIRV/SPIRVExtInst.h|./lib/SPIRV/libSPIRV/SPIRVFunction.h|./lib/SPIRV/libSPIRV/SPIRVInstruction.h|./lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h|./lib/SPIRV/libSPIRV/SPIRVModule.h|./lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h|./lib/SPIRV/libSPIRV/SPIRVOpCode.h|./lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h|./lib/SPIRV/libSPIRV/SPIRVStream.h|./lib/SPIRV/libSPIRV/SPIRVType.h|./lib/SPIRV/libSPIRV/SPIRVUtil.h|./lib/SPIRV/libSPIRV/SPIRVValue.h|./lib/SPIRV/runtime/OpenCL/inc/spirv.h|./lib/SPIRV/runtime/OpenCL/inc/spirv_convert.h|./lib/SPIRV/OCLUtil.h|./lib/SPIRV/OCLTypeToSPIRV.h|./lib/SPIRV/SPIRVInternal.h|./lib/SPIRV/SPIRVMDBuilder.h|./lib/SPIRV/SPIRVMDWalker.h|./lib/SPIRV/SPIRVWriterPass.h)" -checks="-*,readability-identifier-naming" `find . -iname "*.cpp"`
Manual edits:
* lib/SPIRV/Mangler/FunctionDescriptor.cpp
* lib/SPIRV/libSPIRV/SPIRVEntry.h
* lib/SPIRV/libSPIRV/SPIRVDecorate.h
* lib/SPIRV/libSPIRV/SPIRVValue.h
* lib/SPIRV/libSPIRV/SPIRVStream.h
* lib/SPIRV/libSPIRV/SPIRVInstruction.h
* lib/SPIRV/Mangler/ParameterType.cpp
* lib/SPIRV/Mangler/Mangler.cpp
* lib/SPIRV/OCL20ToSPIRV.cpp
* lib/SPIRV/Mangler/ParameterType.h
* lib/SPIRV/SPIRVLowerOCLBlocks.cpp
* lib/SPIRV/SPIRVUtil.cpp
* lib/SPIRV/Mangler/Refcount.h
|
|
clang-tidy does not properly remove when run, so let’s remove it before
running clang-tidy.
Command used: sed -i -e 's/\<m_\([a-zA-Z0-9_]\+\)\>/\u\1/g' `find . -iname "*.cpp"` `find . -iname "*.h"`
|
|
m_refCount does not follow LLVM’s naming guidelines as it uses the “m_”
prefix and does not start with a capital letter. Removing the prefix and
changing the first letter to be a capital letter would result in
“RefCount” which is the class name and causes compilation issues. Hence
why the rename to “Count”.
Command used: sed -i 's/m_refCount/Count/g' `find . -iname "*.cpp"` `find . -iname "*.h"`
|
|
Adding an integer to a string literal does not append it to the string.
|
|
Command used:
/usr/share/clang/run-clang-tidy.py -fix -format -header-filter "(./include/SPIRV.h|./lib/SPIRV/Mangler/FunctionDescriptor.h|./lib/SPIRV/Mangler/ManglingUtils.h|./lib/SPIRV/Mangler/NameMangleAPI.h|./lib/SPIRV/Mangler/ParameterType.h|./lib/SPIRV/Mangler/Refcount.h|./lib/SPIRV/libSPIRV/libSPIRV.h|./lib/SPIRV/libSPIRV/SPIRVBasicBlock.h|./lib/SPIRV/libSPIRV/SPIRVDebug.h|./lib/SPIRV/libSPIRV/SPIRVDecorate.h|./lib/SPIRV/libSPIRV/SPIRVEntry.h|./lib/SPIRV/libSPIRV/SPIRVEnum.h|./lib/SPIRV/libSPIRV/SPIRVError.h|./lib/SPIRV/libSPIRV/SPIRVErrorEnum.h|./lib/SPIRV/libSPIRV/SPIRVExtInst.h|./lib/SPIRV/libSPIRV/SPIRVFunction.h|./lib/SPIRV/libSPIRV/SPIRVInstruction.h|./lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h|./lib/SPIRV/libSPIRV/SPIRVModule.h|./lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h|./lib/SPIRV/libSPIRV/SPIRVOpCode.h|./lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h|./lib/SPIRV/libSPIRV/SPIRVStream.h|./lib/SPIRV/libSPIRV/SPIRVType.h|./lib/SPIRV/libSPIRV/SPIRVUtil.h|./lib/SPIRV/libSPIRV/SPIRVValue.h|./lib/SPIRV/runtime/OpenCL/inc/spirv.h|./lib/SPIRV/runtime/OpenCL/inc/spirv_convert.h|./lib/SPIRV/OCLUtil.h|./lib/SPIRV/OCLTypeToSPIRV.h|./lib/SPIRV/SPIRVInternal.h|./lib/SPIRV/SPIRVMDBuilder.h|./lib/SPIRV/SPIRVMDWalker.h|./lib/SPIRV/SPIRVWriterPass.h)" -checks="-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters" `find . -iname "*.cpp"`
Manual edits:
* lib/SPIRV/libSPIRV/SPIRVStream.h: remove parentheses around `Type` on
line 178;
* lib/SPIRV/libSPIRV/SPIRVStream.cpp: remove parentheses around `Type`
on line 123
* lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h: remove added header guard
|
|
|
|
|
|
|
|
Command used:
/usr/share/clang/run-clang-tidy.py -fix -format -header-filter "(./include/SPIRV.h|./lib/SPIRV/Mangler/FunctionDescriptor.h|./lib/SPIRV/Mangler/ManglingUtils.h|./lib/SPIRV/Mangler/NameMangleAPI.h|./lib/SPIRV/Mangler/ParameterType.h|./lib/SPIRV/Mangler/Refcount.h|./lib/SPIRV/libSPIRV/libSPIRV.h|./lib/SPIRV/libSPIRV/SPIRVBasicBlock.h|./lib/SPIRV/libSPIRV/SPIRVDebug.h|./lib/SPIRV/libSPIRV/SPIRVDecorate.h|./lib/SPIRV/libSPIRV/SPIRVEntry.h|./lib/SPIRV/libSPIRV/SPIRVEnum.h|./lib/SPIRV/libSPIRV/SPIRVError.h|./lib/SPIRV/libSPIRV/SPIRVErrorEnum.h|./lib/SPIRV/libSPIRV/SPIRVExtInst.h|./lib/SPIRV/libSPIRV/SPIRVFunction.h|./lib/SPIRV/libSPIRV/SPIRVInstruction.h|./lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h|./lib/SPIRV/libSPIRV/SPIRVModule.h|./lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h|./lib/SPIRV/libSPIRV/SPIRVOpCode.h|./lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h|./lib/SPIRV/libSPIRV/SPIRVStream.h|./lib/SPIRV/libSPIRV/SPIRVType.h|./lib/SPIRV/libSPIRV/SPIRVUtil.h|./lib/SPIRV/libSPIRV/SPIRVValue.h|./lib/SPIRV/runtime/OpenCL/inc/spirv.h|./lib/SPIRV/runtime/OpenCL/inc/spirv_convert.h|./lib/SPIRV/OCLUtil.h|./lib/SPIRV/OCLTypeToSPIRV.h|./lib/SPIRV/SPIRVInternal.h|./lib/SPIRV/SPIRVMDBuilder.h|./lib/SPIRV/SPIRVMDWalker.h|./lib/SPIRV/SPIRVWriterPass.h)" -checks="-*,modernize-use-override" `find . -iname "*.cpp"`
|
|
Commands run:
* clang-format -i `find . -iname "*.cpp"`
* clang-format -i `find . -iname "*.h"`
Files manually reverted:
* lib/SPIRV/libSPIRV/OpenCL.std.h
* lib/SPIRV/runtime/OpenCL/inc/spirv.h
* lib/SPIRV/runtime/OpenCL/inc/spirv_convert.h
Files manually edited (to fix their first line):
* lib/SPIRV/OCL20ToSPIRV.cpp
* lib/SPIRV/OCL21ToSPIRV.cpp
* lib/SPIRV/SPIRVInternal.h
* lib/SPIRV/SPIRVLowerBool.cpp
* lib/SPIRV/SPIRVLowerMemmove.cpp
* lib/SPIRV/SPIRVToOCL20.cpp
* lib/SPIRV/libSPIRV/SPIRVBasicBlock.cpp
* lib/SPIRV/libSPIRV/SPIRVBasicBlock.h
* lib/SPIRV/libSPIRV/SPIRVDebug.cpp
* lib/SPIRV/libSPIRV/SPIRVDebug.h
* lib/SPIRV/libSPIRV/SPIRVDecorate.cpp
* lib/SPIRV/libSPIRV/SPIRVDecorate.h
* lib/SPIRV/libSPIRV/SPIRVEntry.cpp
* lib/SPIRV/libSPIRV/SPIRVEntry.h
* lib/SPIRV/libSPIRV/SPIRVError.h
* lib/SPIRV/libSPIRV/SPIRVExtInst.h (also added missing include to
SPIRVEnum.h)
* lib/SPIRV/libSPIRV/SPIRVFunction.cpp
* lib/SPIRV/libSPIRV/SPIRVFunction.h
* lib/SPIRV/libSPIRV/SPIRVInstruction.cpp
* lib/SPIRV/libSPIRV/SPIRVInstruction.h
* lib/SPIRV/libSPIRV/SPIRVModule.cpp
* lib/SPIRV/libSPIRV/SPIRVModule.h
* lib/SPIRV/libSPIRV/SPIRVStream.cpp
* lib/SPIRV/libSPIRV/SPIRVStream.h
* lib/SPIRV/libSPIRV/SPIRVType.cpp
* lib/SPIRV/libSPIRV/SPIRVUtil.h
* lib/SPIRV/libSPIRV/SPIRVValue.cpp
* lib/SPIRV/libSPIRV/SPIRVValue.h
|
|
The code was currently using a mix of DOS-style and UNIX-style; LLVM
itself uses UNIX-style.
Commands used:
* dos2unix `find include -iname "*"`
* dos2unix `find lib -iname "*"`
* dos2unix `find test -iname "*"`
* dos2unix `find tools -iname "*"`
|
|
v2: convert to lower case
|
|
Fixes #1
|
|
Change-Id: I10dc4476c2851a54434a47406fff0840da0b9951
|
|
Change-Id: I28e88c5b38463e14a4af4fc0e49e8b95c8debef0
|
|
Change-Id: I97247b6472ff75ea83e12a485e06809ad2d2061c
|
|
Before this commit the SPIR-V/LLVM Translator was part of the LLVM tree.
The history has been rewritten before this commit, so everything not related to
SPIR-V was removed with git filter-branch. Some directories were moved around to
be in accordance with http://llvm.org/docs/Projects.html#source-tree-layout
Also adding CMakeLists.txt and LIT config files.
|
|
With previous code, when intel_sub_group_block_read_us scalar function
was being used, we generated __builtin_spirv_intel_sub_group_block_read_p1i16
built-in name. For naming consistency with OpenCL functions, it should have the "us" included, i.e.
__builtin_spirv_intel_sub_group_block_read_us_p1i16
|
|
In few places in the SPIR-V library a pattern of
“dropAllReferences + removeFromParent” calls was used on values like
functions and instructions, that were not meant to be reused.
These lead to memory leaks, as these functions do not destruct the objects.
The fix is to use “eraseFromParent” instead.
SPIRVDecorate objects were also not deallocated, as they were not added
to owning module’s SPIRVEntry list.
The fix is to add them, as all other similar entries,
e.g. SPIRVDecorationGroup.
|
|
* add the Vector16 capability for both vec8 and vec16 types
* added test to verify Vector16 capability is added for vectors with eight elements
|
|
|
|
|
|
* Decoder.getEntry() may returns NULL
This happens when SPIR-V binary contains useless word which does not belong to
any instruction. Its high 16-bit is 0, and the decoder discards it.
* Decoder.getEntry() may returns NULL
Add a test which contains 2 useless words.
* Use nullptr instead of NULL
test/SPIRV/useless_word.spt -> test/SPIRV/redundant_word.spt
|
|
A forwarded entry has 2 duplicate elements in "IdEntryMap", one element is
at map slot of old id, and another is at forward id.
|
|
* ~SPIRVModuleImpl() crashes when delete no-id entries
It crashes because it tries to delete some no-id entry (OpStore) twice, which is
pushed into vector "EntryNoId" twice.
Do not add entries of SPIRVBasicBlock and SPIRVInstruction into Module when call
Decoder.getEntry(). They will be added at addBasicBlock() and addInstruction().
* ~SPIRVModuleImpl() crashes when delete no-id entries
No-id entries of OpGroupDecorate and OpGroupMemberDecorate are pushed into vector
"EntryNoId" twice. See SPIRVGroupDecorateGeneric::decode(std::istream &I).
No-id entry of OpLine will be deleted by std::shared_ptr automatically.
* ~SPIRVModuleImpl() crashes when delete no-id entries
Use type std::set for "EntryNoId" to avoid duplicate elements.The elements
in std:set are sorted by memory pointer, not by creation order. An entry of
OpLine (A) can be deleted because of deletion of another entry (B) which refers
to A. If A is placed after B, it will try to access invalid A when it frees
"EntryNoId". Therefore, not insert entry of OpLine to "EntryNoId", and it will
be deleted by std::shared_ptr automatically.
|
|
* Fix typo in an assert message and get rid of build warnings.
Value of size_t type is always >= 0; Use explicit conversion from uint64_t to unsigned.
|
|
This commit supplements 94ed068c81cac48eed41e8851115520949664e2c
"Changing translation of llvm.memset intrinsic (#217)"
With arguments bitcasted to i8* OpCopyMemorySized can be correctly
translated to llvm.memcpy, i.e.
llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, ...) instead of
llvm.memcpy.p0i8.p0i8.i32(i8*, [n x i8]*, ...)
|
|
|
|
In most cases llvm.memset is emitted by Clang to do zero-initialization
in default constructors. With this commit this case is handled as followed:
1. Create global variable initialized by a null constant array. Type of
array's element is i8, length of the array is `len` operand of the
llvm.memset intrinsic.
2. Copy the array to the target by OpCopyMemorySized, keeping alignment and
isvolatile arguments.
Translation from SPIR-V to LLVM is updated as well.
Fixes #203
|
|
|
|
|
|
This reverts commit 53688bd35ed4c279ec93b7229e3b741b7ab98b2c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
According to SPIRV specification (p2.4):
"All OpVariable instructions in a function must be in the first block in the
function. These instructions, together with any immediately preceding OpLine
instructions, must be the first instructions in that block."
Therefore, lowered constant expressions must not be inserted at the beginig of
the basic block.
Insert it before the current instruction if the current basic block is the
first one in the function. Otherwise insert it at the end of the first basic
block in the function.
This partially fixes #50
|
|
|
|
|
|
* Fixed problem with OpSpecConstantOp.
In one of last change of spirv spec was added following change:
"Public SPIRV-Headers issues #12 and #13 and Khronos SPIR-V issue #65: Allow OpVariable as an initializer for another OpVariable instruction or the Base of an OpSpecConstantOp with an AccessChain opcode."
In this way, OpVariable can be initialize before OpSpecConstantOp. To do this, it's necessary add OpSpecConstantOp in one container with OpVariable in TopologicalSort. After this change, OpSpecConstantOp and OpVariable instructions will be add to spirv file in the right order.
* Renamed InstructionVec to ConstAndVarVec and fixed indentation
|
|
An LLVM intrinsic should not be transalated to SPIRV as a function call.
Either it's semantics is represented via SPIRV instruction(s)
or an error is reported.
|
|
Changed wordcount to 4. Changing layout of OpLine in module
according to the specification requirements.
|
|
* OpVariable <id> Initializer can be optional
* Fix problem with initializer for external linked type
|
|
|
|
|
|
|