Getting "isn't marked OPAQUE. This might make Clash ignore this primitive"

3 views
Skip to first unread message

peter.t...@gmail.com

unread,
Dec 17, 2023, 2:01:05 PM12/17/23
to Clash - Hardware Description Language
Moved to clash 1.8.1 from 1.6.4 and trying to generate verilog. It generates perfectly under 1.6.4 but the compilation now yields:

> Test/Report/MyReport2.hs:509:1: Warning: primitive Test.Report.MyReport2.report# isn't marked OPAQUE.
> This might make Clash ignore this primitive.

and I see no sign of compilation completing (it should take about 30-40m, currently at the 2h mark).

Is there something I should be doing? Spray a few OPAQUEs around? But where? In the ANN for the primitive, or with the NOINLINE for the function?

Regards

PTB

Leon Schoorl

unread,
Dec 21, 2023, 11:35:43 AM12/21/23
to clash-l...@googlegroups.com
The OPAQUE pragma was added in GHC 9.4. It is like a stronger version of NOINLINE.
The syntax is the same as NOINLINE, except that you can only apply it to top-level binders.
{-# OPAQUE yourFunctionName #-}

On GHC versions that support it clash will now warn you to put OPAQUE pragmas on your primitives. Previously clash did that same but with NOINLINE.
The reason for recommending OPAQUE/NOINLINE annotations on primitives is that clash recognizes primitives by their name, but if GHC decides to inline a call to a primitive then its name disappears and clash can't recognize it anymore.
And OPAQUE makes sure that a call to that name stays there with that exact name.
NOINLINE also kind of did that, but with without the guarantee of keeping the exact name.

Although it's unlikely that to help with your endless compilation problem.
Because the fact that you're seeing that warning means that the problem the warning is intended to address did not occur this time.
But in general it is good practice mark your primitives with OPAQUE.

--
You received this message because you are subscribed to the Google Groups "Clash - Hardware Description Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clash-languag...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clash-language/7747f972-5c0f-4862-8d4b-bcc255f5cec5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages