forked from KhronosGroup/SPIRV-LLVM-Translator
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update translation of kernel metadata to work with new metadata format. #2
Open
AlexeySotkin
wants to merge
48
commits into
master
Choose a base branch
from
tmp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlexeySotkin
force-pushed
the
master
branch
7 times, most recently
from
October 9, 2018 12:18
9c4000a
to
b9dc9e9
Compare
Image type may be represented in llvm IR in two forms: - OpenCL form, for example, '%opencl.image2d_ro_t', - SPIRV form, for example, '%spirv.Image._void_1_0_0_0_0_0_0', but in both cases it is the same image type and it should be mapped to one SPIR-V type.
'cl_intel_subgroup' extension allows to use sub_group_barrier() built-in with OpenCL 1.2/2.0. It requires to translate this built-in to reqular (core) SPIR-V instruction OpControlBarrier. Note: currently clag generates nothing representing vendor extensions like 'cl_intel_subgroup'. So, SPIR-V translator doesn't check that the extensions was enabled. It assumes that if a built-in or a type which belong to one of supported extension used in the IR, this extensions is enabled.
Fix translation of sampler initialization function Update test for sampled image with the current version of LLVM IR
The patch changes mangling rules for types with qualifiers from SPIR1.2 to the latest version of Itanium mangling used in clang, which includes * change in order of qualifiers: first mangles address space, then CVR-qualifiers, * change in substitution rules: private address space is mangled to an empty string, but pointee type + private address space is supposed to be a substitutable entity even private address space is the only qualifier the pointer type has.
A sampler initialized with 0 value is introduced by cl_intel_device_side_avc_motion_estimation extension.
…tor. Instead of default enum initialization of "memory_order_*" constants in SPIRV generator I declared them with specific values. It makes declaration of these constants in SPIRV generator consistent with corresponding constants produced by Clang avoiding any inconsistence. Change-Id: Ida3b373475c248675e1f6adac3b682263a334420
* Change SPIR-V Writer/Reader to consume/produce LLVM IR with blocks and device side enqueue built-ins as it is produced by clang * Improve function pointers removal related to OpenCL 2.0 blocks * Improve tests * Fix translation of literal structs
…onosGroup#53) * Adding asserts to prevent possible dereference of a null pointer * Adding return statements after llvm_unreachable
Removed LIT_SITE_CFG_IN_FOOTER as in llvm repo as in llvm https://reviews.llvm.org/D51357
Starting from version 3.8 clang generates unmangled names for pipe built-ins. Plus reflect changes in LLVM IR introduced by https://reviews.llvm.org/D46015. There are two separate types for read only and write only pipes: opencl.pipe_ro_t and opencl.pipe_wo_t instead of opencl.pipe_t. Changes: * Update SPIRVWriter to consume LLVM IR with non-mangled pipe built-ins. * Align SPIRV Translator to consume and produce new pipe types. Old ones are no longer supported. * Change translation flow to not to convert new pipe types to spirv-friendly format (like spirv.Pipe._0 or spirv.Pipe._1) before translation. Spirv-friendly format for pipes is still supported for consuming or producing.
When llvm-spirv is built out of LLVM tree there might be two cases: - SPIR-V library linked statically. This this case linker and loader are able to handle LLVM symbols correctly. - SPIR-V library linked dynamically. LLVM_LINK_COMPONENTS is ignored as all LLVM components is supposed to be linked into libLLVM.so and we should explicitly link with SPIR-V library. If we build llvm-spirv tool in LLVM tree explicit link with SPIR-V library might lead to multiple symbol definition (e.g. SPIR-V library linked with libLLVM.so as LLVM component and with llmv-spirv tool via explicit target_link_library command).
LLVM lifetime intrinsics accept only i8* pointers + size as object descriptors, so typical pattern for local variables is alloca+bitcast+lifetime instructions. SPIR-V translator tries store original type into lifetime instruction looking though bitcast. It also removes bitcast from the SPIR-V file and tries to recover it during SPIR-V conversion. This patch simplifies the translation by keeping bitcast instruction and fixes assertion of lifetime intrinsics for 8-bit objects.
Some atomic instructions allow only integer result type
AlexeySotkin
force-pushed
the
master
branch
14 times, most recently
from
July 30, 2019 12:49
06783b3
to
9ee05e3
Compare
AlexeySotkin
force-pushed
the
master
branch
5 times, most recently
from
February 3, 2020 11:17
eb22965
to
3f09ec9
Compare
AlexeySotkin
force-pushed
the
master
branch
2 times, most recently
from
April 23, 2020 11:17
6c0cda2
to
4876a17
Compare
AlexeySotkin
force-pushed
the
master
branch
2 times, most recently
from
November 26, 2020 13:37
6322faa
to
3d75de2
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clang 4.0 and higher produces kernel argument metadata attached to a
kernel:
'define spir_kernel void @foo(..) #0 !kernel_arg_addr_space !1 ... {}'
'!1 = !{i32 1, i32 1}'
The patch updates SPIRVWriter to use metadata in this format.
'Old' format:
'!0 = !{void (float addrspace(1), ...) @foo, !1, ...}'
'!1 = !{!"kernel_arg_addr_space", i32 1, ...}'
is no longer supported.
Also changing translation of !opencl.used.extension metadata to
OpSourceExtension instead of translation to OpExtension