3 changes: 2 additions & 1 deletion openmp/runtime/src/z_Linux_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,8 @@ int __kmp_get_load_balance(int max) {
#endif // USE_LOAD_BALANCE

#if !(KMP_ARCH_X86 || KMP_ARCH_X86_64 || KMP_MIC || \
((KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64) || KMP_ARCH_PPC64)
((KMP_OS_LINUX || KMP_OS_DARWIN) && KMP_ARCH_AARCH64) || \
KMP_ARCH_PPC64 || KMP_ARCH_RISCV64)

// we really only need the case with 1 argument, because CLANG always build
// a struct of pointers to shared variables referenced in the outlined function
Expand Down
20 changes: 20 additions & 0 deletions openmp/runtime/test/ompt/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,26 @@ ompt_label_##id:
#define print_possible_return_addresses(addr) \
printf("%" PRIu64 ": current_address=%p or %p\n", ompt_get_thread_data()->value, \
((char *)addr) - 4, ((char *)addr) - 8)
#elif KMP_ARCH_RISCV64
#if __riscv_compressed
// On RV64GC the C.NOP instruction is 2 byte long. In addition, the compiler
// inserts a J instruction (targeting the successor basic block), which
// accounts for another 4 bytes. Finally, an additional J instruction may
// appear (adding 4 more bytes) when the C.NOP is referenced elsewhere (ie.
// another branch).
#define print_possible_return_addresses(addr) \
printf("%" PRIu64 ": current_address=%p or %p\n", \
ompt_get_thread_data()->value, ((char *)addr) - 6, ((char *)addr) - 10)
#else
// On RV64G the NOP instruction is 4 byte long. In addition, the compiler
// inserts a J instruction (targeting the successor basic block), which
// accounts for another 4 bytes. Finally, an additional J instruction may
// appear (adding 4 more bytes) when the NOP is referenced elsewhere (ie.
// another branch).
#define print_possible_return_addresses(addr) \
printf("%" PRIu64 ": current_address=%p or %p\n", \
ompt_get_thread_data()->value, ((char *)addr) - 8, ((char *)addr) - 12)
#endif
#else
#error Unsupported target architecture, cannot determine address offset!
#endif
Expand Down
7 changes: 6 additions & 1 deletion openmp/runtime/tools/lib/Platform.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ sub canon_arch($) {
$arch = "mips64";
} elsif ( $arch =~ m{\Amips} ) {
$arch = "mips";
} elsif ( $arch =~ m{\Ariscv64} ) {
$arch = "riscv64";
} else {
$arch = undef;
}; # if
Expand Down Expand Up @@ -94,6 +96,7 @@ sub canon_mic_arch($) {
"mic" => "Intel(R) Many Integrated Core Architecture",
"mips" => "MIPS",
"mips64" => "MIPS64",
"riscv64" => "RISC-V (64-bit)",
);

sub legal_arch($) {
Expand Down Expand Up @@ -220,6 +223,8 @@ sub target_options() {
$_host_arch = "mips64";
} elsif ( $hardware_platform eq "mips" ) {
$_host_arch = "mips";
} elsif ( $hardware_platform eq "riscv64" ) {
$_host_arch = "riscv64";
} else {
die "Unsupported host hardware platform: \"$hardware_platform\"; stopped";
}; # if
Expand Down Expand Up @@ -409,7 +414,7 @@ the script assumes host architecture is target one.
Input string is an architecture name to canonize. The function recognizes many variants, for example:
C<32e>, C<Intel64>, C<Intel(R) 64>, etc. Returned string is a canononized architecture name,
one of: C<32>, C<32e>, C<64>, C<arm>, C<ppc64le>, C<ppc64>, C<mic>, C<mips>, C<mips64>, or C<undef> is input string is not recognized.
one of: C<32>, C<32e>, C<64>, C<arm>, C<ppc64le>, C<ppc64>, C<mic>, C<mips>, C<mips64>, C<riscv64> or C<undef> is input string is not recognized.
=item B<legal_arch( $arch )>
Expand Down
2 changes: 2 additions & 0 deletions openmp/runtime/tools/lib/Uname.pm
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ if ( 0 ) {
$values{ hardware_platform } = "mips64";
} elsif ( $values{ machine } =~ m{\Amips\z} ) {
$values{ hardware_platform } = "mips";
} elsif ( $values{ machine } =~ m{\Ariscv64\z} ) {
$values{ hardware_platform } = "riscv64";
} else {
die "Unsupported machine (\"$values{ machine }\") returned by POSIX::uname(); stopped";
}; # if
Expand Down
1 change: 1 addition & 0 deletions openmp/www/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Architectures Supported
* IBM(R) Power architecture (big endian)
* IBM(R) Power architecture (little endian)
* MIPS and MIPS64 architectures
* RISC-V 64 bit architecture

Supported RTL Build Configurations
==================================
Expand Down
1 change: 1 addition & 0 deletions openmp/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ <h2 id="requirements">Platform Support</h2>
the Intel compiler.
</li>
<li>MIPS and MIPS64</li>
<li>RISC-V 64-bit</li>
</ul>
Ports to other architectures and operating systems are welcome.
</p>
Expand Down