Git Product home page Git Product logo

Comments (10)

jvesely avatar jvesely commented on September 26, 2024

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.

jvesely avatar jvesely commented on September 26, 2024

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.

jszuppe avatar jszuppe commented on September 26, 2024

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.

PhilipDeegan avatar PhilipDeegan commented on September 26, 2024

@jvesely regarding your first example, this now outputs "101"

perhaps it has been resolved by now?

from hcc.

jvesely avatar jvesely commented on September 26, 2024

Thanks. My machines are offline atm. I'll try to rerun the tests next week.

from hcc.

jvesely avatar jvesely commented on September 26, 2024

@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.

david-salinas avatar david-salinas commented on September 26, 2024

@jvesely The original case works for me with the latest rocm 1.9.

from hcc.

jvesely avatar jvesely commented on September 26, 2024

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.

jvesely avatar jvesely commented on September 26, 2024

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.

jvesely avatar jvesely commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.