Thread overview
dcompute - Error: unrecognized `pragma(LDC_intrinsic)
Feb 27, 2019
Michelle Long
Feb 28, 2019
Nicholas Wilson
Feb 28, 2019
Michelle Long
Feb 28, 2019
Nicholas Wilson
Feb 28, 2019
Michelle Long
Feb 28, 2019
Michelle Long
February 27, 2019
Trying to get dcompute to work... after a bunch of issues dealing with all the crap this is what I can't get past:

Error: unrecognized `pragma(LDC_intrinsic)

This is actually from the ldc.intrinsics file, which I had to rename from .di to d so it would be included in by VisualD.

I upgraded to latest LDC just before

LDC - the LLVM D compiler (1.14.0git-1bbda74):
  based on DMD v2.084.1 and LLVM 7.0.1


pragma(LDC_intrinsic, "llvm.returnaddress")
    void* llvm_returnaddress(uint level);


..\..\..\..\D\LDC\import\ldc\intrinsics.d(85): Error: unrecognized `pragma(LDC_intrinsic)`


February 28, 2019
On Wednesday, 27 February 2019 at 22:56:14 UTC, Michelle Long wrote:
> Trying to get dcompute to work... after a bunch of issues dealing with all the crap this is what I can't get past:
>
> Error: unrecognized `pragma(LDC_intrinsic)
>
> This is actually from the ldc.intrinsics file, which I had to rename from .di to d so it would be included in by VisualD.
>
> I upgraded to latest LDC just before
>
> LDC - the LLVM D compiler (1.14.0git-1bbda74):
>   based on DMD v2.084.1 and LLVM 7.0.1
>
>
> pragma(LDC_intrinsic, "llvm.returnaddress")
>     void* llvm_returnaddress(uint level);
>
>
> ..\..\..\..\D\LDC\import\ldc\intrinsics.d(85): Error: unrecognized `pragma(LDC_intrinsic)`

I've got no idea why that is the case, although I note that you shouldn't need to change intrinsics.di to intrinsics.d, as a .di it only needs to be on the include path which should already be the case for LDC.
February 28, 2019
On Thursday, 28 February 2019 at 02:35:59 UTC, Nicholas Wilson wrote:
> On Wednesday, 27 February 2019 at 22:56:14 UTC, Michelle Long wrote:
>> Trying to get dcompute to work... after a bunch of issues dealing with all the crap this is what I can't get past:
>>
>> Error: unrecognized `pragma(LDC_intrinsic)
>>
>> This is actually from the ldc.intrinsics file, which I had to rename from .di to d so it would be included in by VisualD.
>>
>> I upgraded to latest LDC just before
>>
>> LDC - the LLVM D compiler (1.14.0git-1bbda74):
>>   based on DMD v2.084.1 and LLVM 7.0.1
>>
>>
>> pragma(LDC_intrinsic, "llvm.returnaddress")
>>     void* llvm_returnaddress(uint level);
>>
>>
>> ..\..\..\..\D\LDC\import\ldc\intrinsics.d(85): Error: unrecognized `pragma(LDC_intrinsic)`
>
> I've got no idea why that is the case, although I note that you shouldn't need to change intrinsics.di to intrinsics.d, as a .di it only needs to be on the include path which should already be the case for LDC.

I've included it in Visual D as di and it seems not to add it to the include line...

Is it in any way possible that it being an di file would allow that? Seems that it is an LDC issue though but LDC has some usage of it I believe and it works fine.

Could it be a LDC version? Or do I need to include something to make it work? Seems like it would be part of the compiler itself.

February 28, 2019
On Thursday, 28 February 2019 at 09:58:35 UTC, Michelle Long wrote:
> I've included it in Visual D as di and it seems not to add it to the include line...
>
> Is it in any way possible that it being an di file would allow that? Seems that it is an LDC issue though but LDC has some usage of it I believe and it works fine.
>
> Could it be a LDC version? Or do I need to include something to make it work? Seems like it would be part of the compiler itself.

(I'm on cold and flu meds so apologies if this doesn't make sense)

It should be on the atuoimport path of LDC as that file had others (https://github.com/ldc-developers/druntime/tree/ldc/src/ldc) are part of LDC's druntime which should be imported by ldc's .conf file, it won't show up on the command line unless you do something (... brain not working properly...).

Irrespective of all that, the error comes from

https://github.com/ldc-developers/ldc/blob/f5a5324773484447953746725ea455d2827e6004/dmd/dsymbolsem.d#L1862

which should never happen because this branch should be taken

https://github.com/ldc-developers/ldc/blob/f5a5324773484447953746725ea455d2827e6004/dmd/dsymbolsem.d#L1807

because that pragma is explicitly checked for here

https://github.com/ldc-developers/ldc/blob/187d8198e63564c633f22f2ef4db2a31a8a600ce/gen/pragma.cpp#L110
February 28, 2019
On Thursday, 28 February 2019 at 10:37:22 UTC, Nicholas Wilson wrote:
> On Thursday, 28 February 2019 at 09:58:35 UTC, Michelle Long wrote:
>> I've included it in Visual D as di and it seems not to add it to the include line...
>>
>> Is it in any way possible that it being an di file would allow that? Seems that it is an LDC issue though but LDC has some usage of it I believe and it works fine.
>>
>> Could it be a LDC version? Or do I need to include something to make it work? Seems like it would be part of the compiler itself.
>
> (I'm on cold and flu meds so apologies if this doesn't make sense)
>
> It should be on the atuoimport path of LDC as that file had others (https://github.com/ldc-developers/druntime/tree/ldc/src/ldc) are part of LDC's druntime which should be imported by ldc's .conf file, it won't show up on the command line unless you do something (... brain not working properly...).
>
> Irrespective of all that, the error comes from
>
> https://github.com/ldc-developers/ldc/blob/f5a5324773484447953746725ea455d2827e6004/dmd/dsymbolsem.d#L1862
>
> which should never happen because this branch should be taken
>
> https://github.com/ldc-developers/ldc/blob/f5a5324773484447953746725ea455d2827e6004/dmd/dsymbolsem.d#L1807
>
> because that pragma is explicitly checked for here
>
> https://github.com/ldc-developers/ldc/blob/187d8198e63564c633f22f2ef4db2a31a8a600ce/gen/pragma.cpp#L110



Yeah, in the config it is

    // default switches appended after all explicit command-line switches
    post-switches = [
        "-I%%ldcbinarypath%%/../import",

I've hard coded it and it still doesn't find them.

I've added -conf=

and nothing...

dcompute\driver\cuda\package.d(3): Error: module `dcompute` is in file 'ldc\dcompute.d' which cannot be read

Of course if I manually include it then it gives more problems...

Seems ldc is not even reading the conf file or using it if it is?


If you are right then it seems you are suggesting it is an LDC bug... but that this is highly unlikely...

I am using Visual D and maybe it is all setup for dub and dub takes care of configuring something that Visual D does not?


Note that I've had to include the dcompute imports(downloaded from git), rt(for xmalloc I think), and derelict modules.

I did those because when I added dcompute it would complain about the missing modules so I had to hunt and peck to find them.


When I remove the ldc imports from Visual D,

then the error about missing ldc.dcompute is at

module dcompute.driver.cuda;
public import ldc.dcompute;

which, is in the ldc imports dir(which is why i manually included them which solves it then gives the intrinsics error).


In any case, it seems like it is a very strange bug since `pragma(LDC_intrinsic` should work fine. It's analogous to `pragma(msg` not working in dmd...

Are you using the latest ldc? (1.14.0?)



February 28, 2019
On Thursday, 28 February 2019 at 11:22:49 UTC, Michelle Long wrote:
> On Thursday, 28 February 2019 at 10:37:22 UTC, Nicholas Wilson wrote:
>> [...]
>
>
>
> Yeah, in the config it is
>
> [...]

Also, is it possible that intrinsics are disabled?