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

Cgra merge #174

Draft
wants to merge 380 commits into
base: cgra
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
380 commits
Select commit Hold shift + click to select a range
a44eff8
[Json]: Add device and addrspace to pointer types.
m-kurtenacker Nov 25, 2022
7667117
updated to latest shady API
Hugobros3 Nov 29, 2022
4357af6
Mark Generated Device Code with the correct name to call.
m-kurtenacker Nov 29, 2022
b04b2fa
fixed undefined jump arguments in shady be
Hugobros3 Nov 30, 2022
00e5064
shady: gpu entry point annotations
Hugobros3 Nov 30, 2022
96e435a
Merge branch 'master' into shady
Hugobros3 Dec 1, 2022
6c4d86d
Merge branch 'master' into shady
Hugobros3 Dec 1, 2022
9eb16a3
Add support for external glbobals.
m-kurtenacker Dec 1, 2022
2fbe0e7
Do not evaluate external globals if the initializer is bottom.
m-kurtenacker Dec 1, 2022
9d4b4af
shady files are .shady
Hugobros3 Dec 2, 2022
ee3f679
Bugfix: bad parentheses in resolve_loads.
m-kurtenacker Dec 2, 2022
21bc0f6
fix a few issues with the shady codegen
Hugobros3 Dec 2, 2022
e407338
shady: cmp, arithm
Hugobros3 Dec 2, 2022
494598c
fix some broken codegen
Hugobros3 Dec 3, 2022
f801e88
changed references to 'spirv' to 'shady'
Hugobros3 Dec 3, 2022
0853d32
qualify fn return types
Hugobros3 Dec 4, 2022
f94c74a
use a jump instead of let_into
Hugobros3 Dec 4, 2022
e6bd868
Allow changing the init definition of a Global.
m-kurtenacker Dec 8, 2022
c59f311
Resolve naming conflicts for definite and indefinite array types.
m-kurtenacker Dec 8, 2022
73ab82d
Merge branch 'json_backend' into newmem
m-kurtenacker Dec 8, 2022
bda2713
Json backend fix for newmem.
m-kurtenacker Dec 8, 2022
1b91c03
Some small mistakes in world.h.
m-kurtenacker Dec 15, 2022
f2f2c60
Merge branch 'json_backend' into newmem
m-kurtenacker Dec 15, 2022
278c4fa
[Json]: Forward declarations for nominal types.
m-kurtenacker Jan 3, 2023
1926e45
Merge branch 'json_backend' into newmem
m-kurtenacker Jan 3, 2023
8fa238d
Increase inliner limits to prevent global structs from ocurring in te…
m-kurtenacker Jan 3, 2023
6ec9748
Allow generation of global structs by constructing ConstantStruct
m-kurtenacker Jan 4, 2023
9eaba5d
hoist_enters + importer cleanup.
m-kurtenacker Jan 4, 2023
e2ea393
Merge branch 'norecursion' into newmem
m-kurtenacker Jan 4, 2023
1de509b
update to latest shady API
Hugobros3 Jan 10, 2023
c0961ac
remove structurizer
Hugobros3 Jan 11, 2023
12890d8
Destroy obsolete continuations during partial evaluation.
m-kurtenacker Jan 13, 2023
3053806
Rewrite filter when stubs are created in mangler.
m-kurtenacker Jan 16, 2023
d00f3bd
nuke last remnants of structured control flow support
Hugobros3 Jan 17, 2023
a4f048d
made shady dependency optional
Hugobros3 Jan 17, 2023
698f559
Small fixes.
m-kurtenacker Jan 17, 2023
87e7cdb
Guard continuation creation context, as it takes eons to compute.
m-kurtenacker Jan 18, 2023
d4b30a1
Fix: Tuple type with single element.
m-kurtenacker Jan 18, 2023
562992b
added a World& field to every Def
Hugobros3 Jan 22, 2023
654d935
rebuild() uses new worlds instead of recycling the same one
Hugobros3 Jan 22, 2023
9aeac58
merged Type and Def
Hugobros3 Jan 23, 2023
afd08d7
eliminate commented out code from the importer
Hugobros3 Jan 23, 2023
fc36674
simplify op_name()
Hugobros3 Jan 23, 2023
50cdbdf
fix order
Hugobros3 Jan 23, 2023
baa107f
Merge shady into development
m-kurtenacker Jan 24, 2023
0828fba
Merge branch 'json_backend' into development
m-kurtenacker Jan 24, 2023
8da1756
Merge branch 'norecursion' into development
m-kurtenacker Jan 24, 2023
145dcaf
Merge branch 'newmem' into development
m-kurtenacker Jan 24, 2023
f8f309e
fix issues with params
Hugobros3 Jan 27, 2023
d1bce61
Fix issues with Type::stream.
m-kurtenacker Jan 30, 2023
d5b3625
Merge branch 'unify_def_type' into development
m-kurtenacker Jan 30, 2023
4592046
Revert most changes on norecursion branch.
m-kurtenacker Feb 1, 2023
f5b51a1
[JSON]: AddrSpace Private for ptrtpye added.
m-kurtenacker Feb 3, 2023
d3bafe1
Add Star to type dump.
m-kurtenacker Feb 28, 2023
82a287c
Add CodeGen for AMDGPU + PAL.
richardmembarth May 26, 2023
4eefa45
PAL: set kernel calling convention to AMDGPU_CS.
richardmembarth Jun 13, 2023
d94dec5
Merge remote-tracking branch 'origin/master' into pal
richardmembarth Jul 11, 2023
fd63ebb
Merge remote-tracking branch 'origin/master' into pal
richardmembarth Aug 1, 2023
ec5691c
PAL: set function calling convention to AMDGPU_Gfx.
richardmembarth Aug 1, 2023
5098a73
PAL: remove HSA code.
richardmembarth Aug 1, 2023
bbf515d
Merge remote-tracking branch 'origin/master' into pal
richardmembarth Sep 1, 2023
958e610
Merge remote-tracking branch 'origin/master' into development
m-kurtenacker Sep 4, 2023
9d212b6
Fix convert_closure_type in llvm be.
m-kurtenacker Sep 4, 2023
135aa4e
Fix CMake to allow for cmake based meta repository.
m-kurtenacker Feb 14, 2023
f817729
Shady as global subproject needs special support.
m-kurtenacker Feb 16, 2023
91703e0
Add support for anyopt based linking by adding a CC "internal".
m-kurtenacker Jan 27, 2023
c292516
[JSON] divide emit_stream and emit_json for better runtime usability.
m-kurtenacker Feb 21, 2023
01a4a46
Shady: Emit additional ops.
m-kurtenacker Mar 14, 2023
2d400e8
Fixed long memop chains in json emitter.
m-kurtenacker Jan 23, 2023
8d4f09b
Support stack size changes.
m-kurtenacker Mar 2, 2023
ed05cc0
Fix warnings across the compiler.
m-kurtenacker Aug 1, 2023
e2c74bb
Fix World::extract. Indeces of different types need to be taken into …
m-kurtenacker Jun 30, 2023
0760245
Rewrote scoping analysis, added new debugging facilities
Hugobros3 Sep 4, 2023
7e09016
improved diagnostics for PE
Hugobros3 Sep 11, 2023
32ce4d7
reintroduce boundary check in PE
Hugobros3 Sep 11, 2023
cb7d224
Merge pull request #148 from AnyDSL/hugo-merge-sep-2023
Hugobros3 Sep 12, 2023
09fe3d5
LLVM: Make the codegen more value-oriented, generalise jumping code
Hugobros3 Sep 12, 2023
21422b5
Mark Continuations dropped as device code as being external. No special
m-kurtenacker Sep 14, 2023
8fe13b8
Bug fix: Include config.h in debug.h
m-kurtenacker Sep 15, 2023
e814859
Only exported continuations need to be generated on top level.
m-kurtenacker Sep 15, 2023
e6fece8
Refactored rewriting and passes
Hugobros3 Sep 12, 2023
e92ef28
BE: Check for is_returning, not is_exported. Resolves isssues where
m-kurtenacker Sep 19, 2023
33b54a8
scoped_dump: use stream1 for dumping literals
Hugobros3 Sep 19, 2023
37a18e2
Merge pull request #149 from AnyDSL/passes-rewriter-rework
Hugobros3 Sep 19, 2023
5900d34
Merge pull request #150 from AnyDSL/llvm-codegen-direct-style-primops
Hugobros3 Sep 19, 2023
6e3ce32
simplified/rewrote lifitng code in hls_channels
Hugobros3 Oct 4, 2023
a001780
fix: intrinsics can have multiple ret-alike params
Hugobros3 Oct 10, 2023
deee191
fixed regression with boundary in PE
Hugobros3 Oct 12, 2023
26eeecd
mangle: don't instantiate dead branches if possible
Hugobros3 Oct 12, 2023
8ca2c0a
CC::Thorin for internal continuations.
m-kurtenacker Sep 19, 2023
e369f91
BE: Generate code for exported continuations and everything reachable.
m-kurtenacker Sep 19, 2023
dd2b925
Fix warnings across the compiler.
m-kurtenacker Aug 1, 2023
d0af071
Add stdbool.h and stdint.h to generated header files.
m-kurtenacker Oct 16, 2023
a947aa8
shady: updated API
Hugobros3 Dec 15, 2023
a3d2c22
shady: fixed conversion ops
Hugobros3 Dec 15, 2023
9c15f68
shady: implement a bunch of mathops
Hugobros3 Dec 15, 2023
ebed23c
Fixes to compile HLS code.
m-kurtenacker Jan 16, 2024
f076776
Fix GIDHash to not segfault computing a hash for "(Def*) nullptr".
m-kurtenacker Feb 1, 2024
76dabb1
Abstract class for AMDGPUCodeGen.
richardmembarth Feb 6, 2024
1f938b7
Merge pull request #154 from DFOP-HD/add-pal-backend
richardmembarth Feb 28, 2024
f9b73c4
Merge branch 'master' into development
m-kurtenacker Feb 29, 2024
47f4b88
NVVM: already optimize at compile time.
richardmembarth Mar 15, 2024
62311a4
Merge branch 'development'
m-kurtenacker Mar 20, 2024
924feda
Fix: Do not include execinfo.h if THORIN_ENABLE_CREATION_CONTEXT is not
m-kurtenacker Apr 1, 2024
fb0f721
Fixes #155, thanks @PearCoding for the patch.
m-kurtenacker Apr 9, 2024
3ff6142
fix incorrect usage of TypeOpsMixin leading to UB cast
Hugobros3 May 23, 2024
4515acf
Fix compiler warning.
richardmembarth May 28, 2024
93258e5
Add option to dump thorin IR without color.
richardmembarth May 28, 2024
7793f10
Lift builtins: Wrap continuations without bodies into globals.
m-kurtenacker May 29, 2024
5c2f8af
Fixes to work with a module build of RV and a prebuild LLVM.
m-kurtenacker Dec 15, 2023
d06da8f
Revert removing ${AnyDSL_LLVM_LINK_SHARED} from llvm_config
m-kurtenacker Jun 11, 2024
e173b0b
Add error message if thorin is build with shared libs and LLVM is not.
m-kurtenacker Jun 13, 2024
2400342
llvm: tolerate empty call instr in case of Bottom calls
Hugobros3 Jun 17, 2024
4bb56e7
Merge remote-tracking branch 'personal/master'
m-kurtenacker Jun 18, 2024
0b7694d
hotfix: don't pre-size hashmap in Rewriter
Hugobros3 Jun 19, 2024
1d5aa13
scope-analysis: gate verify() behind THORIN_ENABLE_CHECKS
Hugobros3 Jun 19, 2024
60ca7e0
Merge pull request #162 from m-kurtenacker/master
m-kurtenacker Jun 21, 2024
5b1b623
fix_this())
Hugobros3 Jun 20, 2024
73f3c21
dump: don't include cont. name in param names anymore
Hugobros3 Jun 24, 2024
7bc8434
Merge pull request #157 from AnyDSL/no_color
Hugobros3 Jun 24, 2024
607e79f
First quickfix for some of the problems mentioned in issue #163.
m-kurtenacker Jun 24, 2024
396e974
scoped_dump: fix broken output when app node is shared
Hugobros3 Jun 27, 2024
f62781b
scoped_dump: print CC as part of continuations if non-default
Hugobros3 Jun 27, 2024
cf797d7
scoped_dump: ignore literals at the top-level
Hugobros3 Jun 27, 2024
a15ce11
Merge branch 'master' into development
Hugobros3 Jul 1, 2024
671515c
remove 'device' from PtrType
Hugobros3 Jul 2, 2024
955acc2
revive spir-v backend from the grave
Hugobros3 Jun 27, 2024
cfeb4d5
spirv: API updates
Hugobros3 Jun 27, 2024
ffae8bd
spirv: remove all mentions of structured control flow
Hugobros3 Jun 27, 2024
6f0d6f6
spirv: update branch() to support mem arguments
Hugobros3 Jun 27, 2024
9a4644a
re-introduce select parts of spirv type codegen
Hugobros3 Jun 27, 2024
2fbfc56
spirv: just emit entry points naively
Hugobros3 Jun 27, 2024
8d29a53
spirv: base off Emitter
Hugobros3 Jun 27, 2024
01855fd
builds
Hugobros3 Jun 27, 2024
3d03c0d
cleanup
Hugobros3 Jun 27, 2024
912ab06
spirv: don't leak spirv headers downstream
Hugobros3 Jul 1, 2024
6ebf90e
spirv: advertise in thorin-config.cmake.in
Hugobros3 Jul 1, 2024
e371c8d
spirv: make kernel_config optional
Hugobros3 Jul 1, 2024
c4969b3
add spirv_types to the index
Hugobros3 Jul 1, 2024
e77abf9
spirv: adjust header to not rely on unavailable definitions
Hugobros3 Jul 1, 2024
559ef0c
spirv: emit parameters/phis properly
Hugobros3 Jul 1, 2024
aad02da
spirv: deal with untangible args properly
Hugobros3 Jul 1, 2024
abf4b6a
spirv: emit_bb redirects to emit_constant
Hugobros3 Jul 1, 2024
ae42075
spirv: deal with constants of all primtypes
Hugobros3 Jul 1, 2024
6daf1ea
spirv_builder: improved extended instructions handling
Hugobros3 Jul 1, 2024
19c0f2f
spirv: cache declared capabilities and extensions
Hugobros3 Jul 1, 2024
9ada962
spirv: fix builder multiple definition errors
Hugobros3 Jul 1, 2024
a1509ab
spirv: remove ImportedInstructions
Hugobros3 Jul 1, 2024
2566aec
spirv: initial support for MathOps
Hugobros3 Jul 1, 2024
df2db75
spirv: fix OpenCL copysign
Hugobros3 Jul 1, 2024
7028f0a
spirv: fix some more issues
Hugobros3 Jul 1, 2024
78ea186
spirv: cleanup
Hugobros3 Jul 1, 2024
d728830
spirv: don't use labels as values.
Hugobros3 Jul 1, 2024
74ad6e4
spirv: fix labels
Hugobros3 Jul 1, 2024
0cb78ef
spirv: always use labels for OpPhi
Hugobros3 Jul 1, 2024
93da332
spirv: deal with vectors properly
Hugobros3 Jul 1, 2024
b56a3da
spirv: declare Linkage capability when without entry points
Hugobros3 Jul 1, 2024
9941593
declare capabilities lazily, based on dialect
Hugobros3 Jul 1, 2024
6e67779
spirv: remove old Builtins code
Hugobros3 Jul 1, 2024
2666968
spirv: use VectorComputeINTEL for Private
Hugobros3 Jul 1, 2024
a548bcc
spirv: renamed Target
Hugobros3 Jul 2, 2024
bb32c82
spirv: opencl doesn't want signed integers
Hugobros3 Jul 2, 2024
97fecff
spirv: fix some emission issues
Hugobros3 Jul 2, 2024
14584d3
spirv: add spirv.builtin intrinsic
Hugobros3 Jul 2, 2024
e5f9031
spirv: fix tuple type codegen
Hugobros3 Jul 2, 2024
9f22df5
added Input and Output address spaces
Hugobros3 Jul 2, 2024
cec8afe
whitespace
Hugobros3 Jul 2, 2024
4ffffed
spirv: implement Match
Hugobros3 Jul 2, 2024
4f6563b
spirv: Implement Slot, Enter
Hugobros3 Jul 2, 2024
ec932fa
rewrote DeviceBackends entirely
Hugobros3 Jul 4, 2024
6dc95f7
move and rename KernelLaunchArgs
Hugobros3 Jul 4, 2024
735d8aa
move get_kernel_configs into method
Hugobros3 Jul 4, 2024
410c03a
backends: fix HLS using NVVM intrinsic
Hugobros3 Jul 4, 2024
a5412e0
Merge branch 'spirv' into development
Hugobros3 Jul 5, 2024
5fea491
spirv: fixed LEA using src pointer type instead of dst
Hugobros3 Jul 5, 2024
0f2bfce
fix issues with kernel config ownership
Hugobros3 Jul 5, 2024
d9f5726
remove kernel_config from backend API
Hugobros3 Jul 5, 2024
a256ca6
c: fix broken syntax when accessing tuple components
Hugobros3 Jul 22, 2024
c4b5b8d
backends: fix broken imported cont recovery logic
Hugobros3 Jul 22, 2024
129895a
c: get rid of typedefs and move primtype emission logic into a fn
Hugobros3 Jul 22, 2024
ff8060f
added OpenCL_SPIRV backend
Hugobros3 Jul 25, 2024
cfa14c5
commented out weird LEA address space stuff
Hugobros3 Jul 25, 2024
ca9b0d6
c/opencl: handle ptr as casts
Hugobros3 Jul 25, 2024
0cb3002
Slight updates to switch to llvm 18.
m-kurtenacker Oct 1, 2024
6b3707d
Merge pull request #170 from AnyDSL/llvm_18
m-kurtenacker Oct 16, 2024
11ab8df
spirv: fix Cast def emission
Hugobros3 Oct 16, 2024
80291f0
added LevelZero runtime platform
Hugobros3 Oct 16, 2024
a975790
move runtime enums outside of llvm backend
Hugobros3 Oct 16, 2024
6b41a16
spirv: use Ptr variant of OpAccessChain only where appropriate
Hugobros3 Oct 16, 2024
2c214ec
Do not warn users if RV is not found. We have info messages for that.
m-kurtenacker Jun 24, 2024
3d83a4c
Merge branch 'master' into development
m-kurtenacker Oct 16, 2024
e99f9b8
remove useless args field in spirv::BB
Hugobros3 Oct 18, 2024
64454fc
spirv: share logic between call & intrinsic paths
Hugobros3 Oct 18, 2024
2eba44d
fix: Branch and Match don't have ret_param s
Hugobros3 Oct 18, 2024
8191629
added enum for ground truth of App operands
Hugobros3 Oct 18, 2024
12e48c5
spirv: added a hack to avoid phi nodes with return blocks
Hugobros3 Oct 18, 2024
63da5f8
fix levelzero intrinsic not being registered in codegen.cpp
Hugobros3 Oct 30, 2024
5074b03
spirv: fix dangling reference to target_info_
Hugobros3 Oct 30, 2024
52c208b
spirv: fix typo in error msg
Hugobros3 Oct 30, 2024
702cf3c
spirv: use GLCompute or Kernel appropriately
Hugobros3 Oct 30, 2024
5e5fc8a
spv: fix typo in Cast
Hugobros3 Oct 30, 2024
8e8c309
fix interface of generated spv kernel to include builtins
Hugobros3 Oct 30, 2024
cbd75e5
spv: emit spv 1.2 for OpenCL
Hugobros3 Oct 30, 2024
336e262
codegen: add seperate notion of 'Offload' intrinsics
Hugobros3 Nov 4, 2024
30df11e
fix fp64 constant emission
Hugobros3 Nov 4, 2024
2b1b4fc
spirv_builder.hpp: move FileBuilder first
Hugobros3 Nov 4, 2024
bc35e0f
spirv_builder.hpp: remove now-useless generate_fresh_id wrappers
Hugobros3 Nov 4, 2024
b87c863
spirv_builder.hpp: made file_builder field in FnBuilder a reference
Hugobros3 Nov 4, 2024
e20add3
spirv_builder.hpp: rename op() into begin_op()
Hugobros3 Nov 4, 2024
5a60b50
spirv: renamed a bunch of types to drop the 'Spv' prefix
Hugobros3 Nov 4, 2024
90261bb
spirv_builder.hpp: move terminators into their own section
Hugobros3 Nov 4, 2024
7dd78b9
spirv: fix int8 and fp16, 64 not declaring relevant capabilities
Hugobros3 Nov 4, 2024
f26d0fd
spirv_builder.hpp: ensure only one TypeVoid exists
Hugobros3 Nov 4, 2024
b5d6d85
spirv: fix LEA on array types
Hugobros3 Nov 4, 2024
19108af
spirv: use OpPtrCastToGeneric when allocating on the stack
Hugobros3 Nov 4, 2024
f7819d1
spirv: workarround for broken OpCompositeConstruct
Hugobros3 Nov 4, 2024
d4786b0
account for another bug in the SPIRV-LLVM translator
Hugobros3 Nov 4, 2024
17991eb
move emit_intrinsic to spirv_instructions.cpp
Hugobros3 Nov 8, 2024
720c161
spirv: use the mathop path for intrinsics named the same
Hugobros3 Nov 8, 2024
4c703c2
spirv: added support for reserve_shared
Hugobros3 Nov 8, 2024
e6b9ad2
spirv: added support for 'min', 'max' intrinsics
Hugobros3 Nov 8, 2024
5dd14ae
spirv: implement more ops
Hugobros3 Nov 8, 2024
ce056c1
spirv: fix OpBarrier and OpIAtomicAdd emission
Hugobros3 Nov 12, 2024
ffd197f
spirv: support for emitting variants
Hugobros3 Nov 12, 2024
feae51a
spirv: fix emission of external continuations
Hugobros3 Nov 12, 2024
4e7393c
spirv: refactor dom/codom code
Hugobros3 Nov 12, 2024
0852166
spirv: fix broken store() when emitting variants
Hugobros3 Nov 12, 2024
fdb006d
spirv_builder: add literal_string infra
Hugobros3 Nov 12, 2024
c746963
spirv: fix reserve_shared
Hugobros3 Nov 12, 2024
dbbd974
spirv: do not emit device functions
Hugobros3 Nov 12, 2024
adfd62d
spirv: use emit_composite for variants
Hugobros3 Nov 12, 2024
3638b59
spirv: fix some casting behaviours
Hugobros3 Nov 12, 2024
1bf6692
spirv: add rv_all and atomic_add for fp types
Hugobros3 Nov 12, 2024
51cc4a3
spirv: hack: avoid emitting plain structs in kernel params
Hugobros3 Nov 13, 2024
6621979
Match LLVM's required CMake version.
richardmembarth Nov 15, 2024
537c0fd
spirv: improve how bitcasts are handled
Hugobros3 Nov 19, 2024
5abfbc7
spv: place structs in Function arguments
Hugobros3 Nov 19, 2024
14c9793
spirv: fix wrong layout for execution_modes
Hugobros3 Nov 19, 2024
719570d
spirv: better filtering for unit types
Hugobros3 Nov 19, 2024
cf42088
spirv: updated spirv_builder.hpp
Hugobros3 Nov 21, 2024
f7bdd76
spirv: emit global atomic instead
Hugobros3 Nov 21, 2024
41c618a
Merge pull request #171 from AnyDSL/spirv
Hugobros3 Nov 22, 2024
ca68fb9
spirv: fix regression
Hugobros3 Nov 22, 2024
a8e0ce5
Merge pull request #172 from AnyDSL/development
Hugobros3 Nov 22, 2024
9af4dcc
added default virtual destructor to Backend
Hugobros3 Nov 22, 2024
9acff43
spirv: implement atomic_min
Hugobros3 Nov 27, 2024
b19176c
spirv: use appropriate scope/semantic mask depending on atomic ptr param
Hugobros3 Nov 27, 2024
13db35d
spirv: fix reserve_shared
Hugobros3 Nov 27, 2024
174499e
spirv: emit barrier() as a Control barrier instead
Hugobros3 Nov 28, 2024
3cd7953
Merge branch 'master' into cgra.
m-kurtenacker Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
spv: place structs in Function arguments
Hugobros3 committed Nov 19, 2024
commit 5abfbc7042de75ed1d19363c6bd670b568126abc
10 changes: 5 additions & 5 deletions src/thorin/be/spirv/spirv.cpp
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ Id CodeGen::emit_fun_decl(thorin::Continuation* continuation) {
return get_fn_builder(continuation).function_id;
}

static bool prefers_passing_by_ptr(const Type* t) {
static bool cl_demands_passed_by_reference(const Type* t) {
return t->isa<VariantType>() || t->isa<TupleType>() || t->isa<StructType>();
}

@@ -175,8 +175,8 @@ static const FnType* patch_entry_point_signature(const FnType* type) {
auto& world = type->world();
std::vector<const Type*> new_ops;
for (auto t : type->types()) {
if (prefers_passing_by_ptr(t))
t = world.ptr_type(t, 1, AddrSpace::Global);
if (cl_demands_passed_by_reference(t))
t = world.ptr_type(t, 1, AddrSpace::Function);
else if (auto fn = t->isa<FnType>())
t = patch_entry_point_signature(fn);
else if (auto ptr = t->isa<PtrType>()) {
@@ -254,8 +254,8 @@ void CodeGen::prepare(thorin::Continuation* cont, FnBuilder* fn) {
defs_[param] = 0;
} else if (param->order() == 0) {
Id id;
if (entry_point && prefers_passing_by_ptr(param->type())) {
auto param_t = convert(world().ptr_type(param->type(), 1, AddrSpace::Global));
if (entry_point && cl_demands_passed_by_reference(param->type())) {
auto param_t = convert(world().ptr_type(param->type(), 1, AddrSpace::Function));
id = fn->parameter(param_t.id);
builder_->decorate(id, spv::DecorationFuncParamAttr, { spv::FunctionParameterAttribute::FunctionParameterAttributeByVal });
builder_->decorate(id, spv::DecorationFuncParamAttr, { spv::FunctionParameterAttribute::FunctionParameterAttributeNoCapture });