Comments (10)
note that the same problem exists when using static local variables.
fails.cpp:
#include <amp.h>
#include <iostream>
int &get_value() restrict(amp,cpu)
{
static int v = 6;
return v;
}
int main(void)
{
::std::atomic_uint sum;
get_value() = 8;
sum = get_value();
parallel_for_each(concurrency::extent<1>(100),
[&](concurrency::index<1> i) restrict (amp)
{
sum += get_value();
});
::std::cout << sum << "\n";
return 0;
}
$ ./test
608
works.cpp:
#include <amp.h>
#include <iostream>
int &get_value() restrict(amp,cpu)
{
static int v = 6;
return v;
}
int main(void)
{
::std::atomic_uint sum;
get_value() = 7;
sum = get_value();
int &val_l = get_value();
parallel_for_each(concurrency::extent<1>(100),
[&](concurrency::index<1> i) restrict (amp)
{
sum += val_l;
});
::std::cout << sum << "\n";
return 0;
}
$ ./test
707
from hcc.
note program built with the latest hcc gives this error:
$ ./atomic-global
Backtrace:
0x00007fc48fbe4c91: Kalmar::HSADevice::BuildOfflineFinalizedProgramImpl(void*, int) + 0x221
0x00007fc48fbd4660: Kalmar::HSADevice::BuildProgram(void*, void*) + 0x140
0x000000000040fe54: Kalmar::KalmarBootstrap::KalmarBootstrap() + 0x124
0x000000000040fd09: __hcc_shared_library_init + 0x29
0x0000000000410f0d: __libc_csu_init + 0x4d
0x00007fc4906b149b: __libc_start_main + 0x7b
0x0000000000410e0a: _start + 0x2a
### HCC STATUS_CHECK Error: HSA_STATUS_ERROR_VARIABLE_UNDEFINED (0x1015) at file:mcwamp_hsa.cpp line:2918
Aborted (core dumped)
from hcc.
We get the same error when a constexpr static
data member of a class is odr-used (required definition at namespace scope is provided).
from hcc.
@jvesely regarding your first example, this now outputs "101"
perhaps it has been resolved by now?
from hcc.
Thanks. My machines are offline atm. I'll try to rerun the tests next week.
from hcc.
@dekken my machines are back up, but I can't reproduce your success.
the latest hcc fails to build (configure failure with incorrect clang path), after fixing that issue it complains when compiling for my gpu:
-amdgpu-target argument 'gfx801' is not recognized; using gfx803 instead [-Winvalid-command-line-argument]
objcopy: /tmp/tmp.Xlqbe1bWHS/static-test-6023c5.host.o: Failed to find link section for section 19
objcopy: /tmp/tmp.Xlqbe1bWHS/static-test-6023c5.host.o: Failed to find link section for section 19
it does produce a binary though, but trying to run it results in:
### HCC STATUS_CHECK Error: HSA_STATUS_ERROR_INVALID_ISA_NAME (0x1017) at file:mcwamp_hsa.cpp line:2683
from hcc.
@jvesely The original case works for me with the latest rocm 1.9.
from hcc.
I'm trying to setup rocm 1.9 on my machine but it looks like carrizo (or is it all apus?) is not supported.
I fixed the objcopy complaint so now I just get the warning and "invalid isa name" crash.
So I don't think I'll be able to confirm whether this has been resolved.
from hcc.
Turns out that my setup is no longer supported. Clang code explicitly includes:
bool is_valid(const std::string& gfxip)
{
static constexpr std::array<const char*, 4u> valid = {
{ "gfx701", "gfx803", "gfx900", "gfx906" }};
return std::find(valid.cbegin(), valid.cend(), gfxip) != valid.cend();
}
It'd be nice if AMD was less cryptic about throwing users with older HW overboard. Especially since Carrizo APU was advertised for HSA ("And the upcoming βCarrizoβ APU takes HSA support even further, with design features to make it fully compliant with the HSA 1.0 specification.β")[0].
[0] https://www.amd.com/en-us/innovations/software-technologies/server-solution/hsa
from hcc.
After recovering Carrizo suport in hcc, I can confirm that global variable test works as expected.
The static variable test does not, I guess the __CPU__
and __HC__
functions are different with different static namespace.
from hcc.
Related Issues (20)
- HIP Program crash with missing constructor when compiled with HCC HOT 1
- HCC clamp-device segfaults compiling HIP program HOT 2
- Compiler crash in EmitCallArg
- how to increase printf buffer size in kernel code?
- 'libunwind.h' file not found
- build source code of hcc 2.10 error
- build failure
- Is hcc really deprecated? HOT 5
- compile error from source code
- Do not use system ld in hc-kernel-assemble HOT 1
- Invalid record
- CMake warning on nested find_package
- libmcwamp and libhc_am are circularly dependent
- @Ghostplant links are 404
- extractkernel for rdc code HOT 3
- running heterogeneous benchmark like chai in gem5gcn3
- Please enable two factor authentication in your github account
- How to convert LDS memory address to the address can be passed into DS_READ_* and DS_WRITE_* instructions? HOT 2
- Inline assembly of DS_WRITE_B128 compile error Don't know how to handle indirect register inputs yet for constraint 'v' HOT 1
- hipcc does not hipify __nvvm_get_smem_pointer function HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hcc.