Commit Graph

97800 Commits

Author SHA1 Message Date
zhoujing 9b11eb8feb [NFC][fix] Fix test cases failure 2024-03-07 10:57:30 +08:00
Jules-Kong 1a04073d12 [VENTUS][NFC] Remove dead code and refactor code
1. The variable NumRetVGPRs is not used;
2. According to the purpose of function numRegsForType, it is more suitable as
a public member function.
2024-03-04 18:52:01 +08:00
Mifuns e4c88939fe
[#60][feat] Support barrier with memory scope parameter (#63)
Co-authored-by: qinfan <qinfan.wang@terapines.com>
2023-11-22 16:02:16 +08:00
zhoujingya c25d00552c [VENTUS][fix] Legalize vlw12.v instruction for variadic functions 2023-09-07 16:39:11 +08:00
zhoujing 758644eec1 [VENTUS][fix] Fix function calling pointer cast issuse
`void print_ints_uchar(param_t *p, const void *vals , int n, int is_unsigned)`
The second argument is a void pointer, but when we call this function with a non-void
pointer, in traditional C code, this action is legal, but when this pointer carrys different
address space, llvm will report error, we now just avoid this check
`print_ints_uchar(&p,  &val, vector_length, is_unsigned)`
2023-08-11 15:47:27 +08:00
zhoujing c09d292fad [VENTUS][fix] Fix call IR codegen
Since printf is writtn in c, the function calling has address space mapping issue
2023-08-10 15:01:54 +08:00
zhoujing 198eea9938 [VENTUS][feat] Support varadic function && enable address space in vastart/vaend 2023-08-08 15:45:41 +08:00
zhoujing 9da5d1dbb1 [VENTUS][RISCV][NFC] Disable macro-redefined warining 2023-07-27 09:31:37 +08:00
zhoujing 6f502d2c33 [VENTUS][RISCV][fix] Set correct datalayout for different language options 2023-07-25 16:55:05 +08:00
zhoujing b8223e72bd [VENTUS][RISCV][feat] Building libclc library into object file other than archive file
In our previous design, the libclc library is built into static library which make the generated
ELF file having a large size, now we change compiler and linker option to make generated ELF file size much smaller, detail information can be seen in this pull request https://github.com/THU-DSP-LAB/pocl/pull/11
2023-07-17 21:39:02 +08:00
zhoujing 760e86baf2 [VENTUS][RISCV][fix&feat] Add cl_khr_fp64 support and add missing header file 2023-07-13 09:21:50 +08:00
zhoujing ec224ea8a4 [VENTUS][RISCV][feat] Add `cl_khr_byte_addressable_store` feature 2023-06-29 11:02:17 +08:00
zhoujing 2126d76353 [VENTUS][RISCV][fix] Fix IR datalayout reset bugs 2023-06-28 22:36:58 +08:00
yanming ce66ea4870 [VENTUS][RISCV] Disable tail call for ventus-gpgpu 2023-06-26 15:46:24 +08:00
zhoujing 615705a6c6 [VENTUS][RISCV][fix] Fix calling convention 2023-06-19 17:21:04 +08:00
zhoujing 53a932e665 [VENTUS][RISCV][fix] Modify calling convention for non-kernel function arguments based on private memory address
In our previous calling convention design, all non-kernel arguments are passed
by VGPRS or TP stack, but when the arguments point to private memory address
space, the wrong memory access instructions will be generated, because private
memory based address is scalar register
2023-06-14 21:26:53 +08:00
zhoujing 033505de1d [VENTUS][RISCV][fix] Modify calling convention 2023-06-05 17:11:25 +08:00
zhoujing 967cb725c8 [VENTUS][RISCV][feat] Set ventus kernel for OpenCL kernel functions 2023-06-05 13:10:35 +08:00
zhoujing 8c7f5a3c28 [VENTUS][RISCV][fix] Fix instructuions which contain 5 bits unsigned immediate asmParser && pattern bug 2023-05-26 17:52:36 +08:00
zhoujingya 9d9283fa7b [VENTUS][RISCV][fix] Fix ventus abi and calling convention
Kernel functions use sp as GPRs spill stack slots
Non-kernel functions use tp as VGPRs spill stack slots
2023-04-20 15:27:52 +08:00
zhoujingya 8ba248d102 [VENTUS][RISCV] Add vararg support
Because ventus riscv is designed specially for OpenCL language, we originally add or remove some language features mainly for serving OpenCL, but we now need to add customized `printf` function which is expected to be written in C, so we need also to add support for C language features in current ventus

Signed-off-by: zhoujingya <jing.zhou@terapines.com>
2023-04-13 15:00:35 +08:00
zhoujingya dfc6b4d7f0 Fix VI instruction codegen bug && disable declare-opencl-builtins option for opencl 2023-03-20 16:30:08 +08:00
zhoujingya 553e65dcf7 Change barrier and work_group_barrier into builtin functions 2023-03-14 10:38:22 +08:00
zhoujing a92723f212 Update barrier intrinsics' name and modify barrier's encoding 2023-02-10 14:50:40 +08:00
zhoujing 18810a86c0 Update barrier&barriersub instructions, codegen test cases for barrier builtins and intrinsics 2023-02-10 10:27:46 +08:00
zhoujing 59ec313359 Add riscv builtin support for opencl barrier function 2023-02-09 17:53:15 +08:00
Aries c0ccb59e9f WORKAROUND: Fix libclc building error 2023-01-16 16:05:08 +08:00
Aries c4e5ff31b2 Fix OpenCL address space mapping 2023-01-16 10:28:37 +08:00
Aries b21d1cd948 Change char to signed char for Ventus OpenCL device 2023-01-16 10:28:03 +08:00
Aries 0b43b70327 Fix bug in addressing space mapping 2023-01-03 10:45:58 +08:00
Aries 27111da83b Add OpenCL addressing space to target addressing space mapping 2022-12-20 14:49:50 +08:00
Aries dee3135130 Drafting divergent related code, not working yet. 2022-12-19 18:11:34 +08:00
Aries 9c54c010b2 [clang] Add initial support to Ventus GPGPU calling convention for llvm IR codegen. 2022-12-14 11:31:30 +08:00
Fangrui Song a996cc217c Remove unused #include "llvm/ADT/Optional.h" 2022-12-05 06:31:11 +00:00
Kazu Hirata 7760971741 Forward-declare raw_ostream (NFC)
This patch adds forward declarations of raw_ostream to those header
files that are relying on the forward declaration of raw_ostream in
llvm/include/llvm/ADT/Optional.h.

I'm planning to move operator<< for Optional<T> and std::optional<T>
from Optional.h to llvm/include/llvm/Support/raw_ostream.h.  Once I do
so, we no longer need to forward-declare raw_ostream in Optional.h.
2022-12-04 21:43:10 -08:00
Kazu Hirata 22731dbd75 [clang] Use std::nullopt instead of None in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04 20:31:05 -08:00
Fangrui Song 89fae41ef1 [IR] llvm::Optional => std::optional
Many llvm/IR/* files have been migrated by other contributors.
This migrates most remaining files.
2022-12-05 04:13:11 +00:00
Weining Lu 47edc70866 [LoongArch] Specify registers used for exception handling
See definition in backend D134709 and the doc [1] for more detail.

With the benefit of this change, most libcxx and libcxxabi tests pass.

[1]: https://llvm.org/docs/ExceptionHandling.html

Reviewed By: xen0n, wangleiat

Differential Revision: https://reviews.llvm.org/D139177
2022-12-05 11:42:41 +08:00
Vitaly Buka 9e8787821f [test][CodeGen] Check noundef for omited return 2022-12-04 19:10:17 -08:00
Vitaly Buka 262d6d495c [test][CodeGen] Check noundef for return value 2022-12-04 19:10:17 -08:00
Vitaly Buka a3b48e0945 [NFC][CodeGen] Extract HasStrictReturn 2022-12-04 19:10:17 -08:00
Vitaly Buka 487edfa432 [NFC][CodeGen] Add const to a method 2022-12-04 19:10:17 -08:00
Kazu Hirata 35b4fbb559 [clang] Use std::nullopt instead of None in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04 15:57:24 -08:00
Fangrui Song eecb22d8e1 [SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section
D130887 uses a dummy empty section `sanmd_covered` (with the SHF_GNU_RETAIN flag on
ELF) to prevent `undefined symbol: __start_sanmd_covered` if all `sanmd_covered`
are discarded by `ld --gc-sections` (in `-z start-stop-gc` mode).

The dummy `sanmd_covered` does not have the SHF_LINK_ORDER flag, so mixing it
with SHF_LINK_ORDER `sanmd_covered` causes an issue to GNU ld<2.36
(https://sourceware.org/bugzilla/show_bug.cgi?id=26256).

Similar to D98903 for SanitizerCoverage, let's make encapsulation symbols
undefined weak[1]. This additionally avoids size cost due to the dummy section and
symbol.

[1]: https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D139276
2022-12-04 15:06:34 -08:00
Kazu Hirata 86d8f2ce97 [clang] Use std::nullopt instead of None (NFC)
I've verified that every change in this patch affects generated files
and would reduce the number of warnings if None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04 13:52:44 -08:00
Fangrui Song 4e62072ca1 [Passes] llvm::Optional => std::optional 2022-12-04 20:44:52 +00:00
Owen Pan e33243c950 [clang-format] Link the braces of a block in UnwrappedLineParser
This includes TT_MacroBlockBegin and TT_MacroBlockEnd as well.

We can no longer use MatchingParen of FormatToken as an indicator
to mark optional braces. Instead, we directly set Optional of an
l_brace first and reset it later if it turns out that the braces
are not optional.

Also added a test case for deeply nested loops.

Differential Revision: https://reviews.llvm.org/D139257
2022-12-04 12:01:26 -08:00
Benjamin Kramer 8956852194 Undo a bit of fcf4e360ba that confuses MSVC
clang\lib\Serialization\GlobalModuleIndex.cpp(818): error C2440: 'initializing': cannot convert from 'const ValueTy' to '_Ty2 &&'
        with
        [
            ValueTy=llvm::SmallVector<unsigned int,2>
        ]
        and
        [
            _Ty2=llvm::SmallVector<unsigned int,2>
        ]
2022-12-04 20:33:25 +01:00
Fangrui Song 7d43c3ba51 IR: HotnessThreshold llvm::Optional => std::optional 2022-12-04 19:06:47 +00:00
Krzysztof Parzyszek 0ca43d4488 DebugInfoMetadata: convert Optional to std::optional 2022-12-04 11:52:02 -06:00