__typeof__ in blis.h

18 views
Skip to first unread message

Shivaprashanth H

unread,
Jun 18, 2020, 3:05:38 PM6/18/20
to blis-devel
In generated blis.h file, I see a macro as below using __typeof__ keyword.
as per my understanding (spent good amount of time googling around), this keyword is not supported in msvc compiler.

#define bli_cxxpbyris( xr, xi, br, bi, yr, yi ) \
{ \
const __typeof__ (yr) yt_r = (xr) + (br) * (yr) - (bi) * (yi); \
const __typeof__ (yi) yt_i = (xi) + (bi) * (yr) + (br) * (yi); \
(yr) = yt_r; \
(yi) = yt_i; \
}

switching to decltype, auto or _Generic keywords has not helped.
I think this is the only issue if resolved will make blis.h compilable in msvc
is there any alternate to __typeof__ which is portable across different compilers?

Field G. Van Zee

unread,
Jun 18, 2020, 3:37:53 PM6/18/20
to blis-...@googlegroups.com
Shiva,

For what it's worth, I'm in the early stages of a rewrite that removes
the use of the __typeof__ keyword (though that was not the reason for
the rewrite). But this won't help you anytime soon.

According to gcc documentation, __type__ is ISO C [1]. MSVC is notorious
for being standards non-compliant, and we tend to not change our code to
accommodate these kinds of broken development tools. That said, someone
on the mailing list may (hopefully) have a workaround.

Field

[1] https://gcc.gnu.org/onlinedocs/gcc/Typeof.html


On 6/18/20 2:05 PM, Shivaprashanth H wrote:
> In generated blis.h file, I see a macro as below using __typeof__ keyword.
> as per my understanding (spent good amount of time googling around),
> this keyword is not supported in msvc compiler.
>
> #define bli_cxxpbyris( xr, xi, br, bi, yr, yi ) \
> { \
> const*__typeof__* (yr) yt_r = (xr) + (br) * (yr) - (bi) * (yi); \
> const*__typeof__* (yi) yt_i = (xi) + (bi) * (yr) + (br) * (yi); \
> (yr) = yt_r; \
> (yi) = yt_i; \
> }
>
> switching to decltype, auto or _Generic keywords has not helped.
> I think this is the only issue if resolved will make blis.h compilable
> in msvc
> is there any alternate to __typeof__ which is portable across different
> compilers?
>
>
> Disclaimer:This message is intended only for the designated
> recipient(s). It may contain confidential or proprietary information and
> may be subject to other confidentiality protections. If you are not a
> designated recipient, you may not review, copy or distribute this
> message. Please notify the sender by e-mail and delete this message.
> GlobalEdge does not accept any liability for virus infected mails.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blis-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blis-devel+...@googlegroups.com
> <mailto:blis-devel+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/blis-devel/650fd825-b08f-4e1e-b79f-5ed74f745889o%40googlegroups.com
> <https://groups.google.com/d/msgid/blis-devel/650fd825-b08f-4e1e-b79f-5ed74f745889o%40googlegroups.com?utm_medium=email&utm_source=footer>.

Jed Brown

unread,
Jun 18, 2020, 3:52:47 PM6/18/20
to Field G. Van Zee, blis-...@googlegroups.com
"Field G. Van Zee" <fi...@cs.utexas.edu> writes:

> According to gcc documentation, __type__ is ISO C [1].

I assume you mean __typeof__, but that's not what the docs say. The
keyword is not ISO C. What it's referring to is that *if* you use gcc
-std=c11 (or any other c* standard), then gcc will object to "typeof"
while still allowing "__typeof__". If you use -std=gnu11 (or other gnu*
standard), then you can use either name. There's no implication that it
should work with other compilers (unless they claim to implement the
gnu* dialects).

Field G. Van Zee

unread,
Jun 18, 2020, 4:17:59 PM6/18/20
to Jed Brown, blis-...@googlegroups.com


On 6/18/20 2:52 PM, Jed Brown wrote:
> "Field G. Van Zee" <fi...@cs.utexas.edu> writes:
>
>> According to gcc documentation, __type__ is ISO C [1].
>
> I assume you mean __typeof__, but that's not what the docs say. The

Yes, this was a typo.

> keyword is not ISO C. What it's referring to is that *if* you use gcc
> -std=c11 (or any other c* standard), then gcc will object to "typeof"
> while still allowing "__typeof__". If you use -std=gnu11 (or other gnu*
> standard), then you can use either name. There's no implication that it
> should work with other compilers (unless they claim to implement the
> gnu* dialects).

I misunderstood the documentation, then. Thanks for pointing this out.
(If I had understood it properly, I would have never inserted usage of
__typeof__ to begin with since BLIS strives to hew as closely to ISO C99
as possible.)

Field

Jeff Hammond

unread,
Jun 18, 2020, 6:02:34 PM6/18/20
to Field G. Van Zee, Jed Brown, blis-discuss
TL;DR If BLIS is compiled with MSVC as C++, use decltype from C++11.  If BLIS uses MSVC without C++11, then there does not appear to be a simple or general solution.

StackOverflow is our friend:


Jeff

--
You received this message because you are subscribed to the Google Groups "blis-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blis-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blis-devel/9347c752-ffbc-c96f-037c-bad317352cb0%40cs.utexas.edu.


--

Shivaprashanth H

unread,
Jun 19, 2020, 5:06:04 AM6/19/20
to blis-devel
https://www.boost.org/doc/libs/1_73_0/doc/html/typeof.html
this is some third party lib it seems. This page at the end mentions
"The purpose of the Boost.Typeof library is to provide a library-based solution, which could be used until the language-based facility is added to the Standard and becomes widely available."

decltype I tried. Changed the preferred compiler to c++. After that I am getting different errors. I am not sure if its worth to do that.
I think using boost lib also expects to select C++ compiler so mostly I will get more errors. I will give it a try and update.

Field G. Van Zee

unread,
Jun 19, 2020, 4:09:40 PM6/19/20
to Shivaprashanth H, blis-devel
Shiva,

I had some ideas on how I might hack out the use of __typeof__() from
BLIS. The method I employed isn't quite up to my usual design standards,
but I'm willing to compromise here since all of this code is in the
process of being rewritten anyway, and the consumers of the affected
scalar operations are limited.

I've implemented this fix in commit 424e5e0a, which can currently be
found on the 'dev' branch. Please give this a try and let us know how it
goes. If it works, I'll merge 'dev' into 'master' immediately.

Field
> Disclaimer:This message is intended only for the designated
> recipient(s). It may contain confidential or proprietary information and
> may be subject to other confidentiality protections. If you are not a
> designated recipient, you may not review, copy or distribute this
> message. Please notify the sender by e-mail and delete this message.
> GlobalEdge does not accept any liability for virus infected mails.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blis-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blis-devel+...@googlegroups.com
> <mailto:blis-devel+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/blis-devel/28eab5d2-06e1-4b03-b001-8038a30b4a42o%40googlegroups.com
> <https://groups.google.com/d/msgid/blis-devel/28eab5d2-06e1-4b03-b001-8038a30b4a42o%40googlegroups.com?utm_medium=email&utm_source=footer>.

Shivaprashanth H

unread,
Jun 23, 2020, 3:31:50 AM6/23/20
to blis-devel
Sure Field. Let me try this out.

Thanks
Shiva

Shivaprashanth H

unread,
Jun 23, 2020, 7:06:28 AM6/23/20
to blis-devel
The 424e5e0a changes are building fine.
Tested the dll with below randomly chosen example codes in VS

Oapi
1. 00obj_basic
2. 10util
3. 06level1m
4. 04level0

Tapi
1. 04level3
2. 01level1m

I am yet to port the testsuite to VS. Once that is done, will perform full testing.

Field G. Van Zee

unread,
Jun 23, 2020, 12:40:42 PM6/23/20
to blis-...@googlegroups.com
Shiva,

I'm glad the example codes are working for you. Ideally, you would build
the testsuite and run it for a more exhaustive test sweep. But this may
be non-trivial if you aren't making use of the build system that BLIS
provides.

If you run into further trouble, I encourage you to open an issue on
github.com [1].

Field

[1] https://github.com/flame/blis/issues
> > an email to blis-devel+...@googlegroups.com
> <mailto:blis-devel%2Bunsu...@googlegroups.com>
> > <mailto:blis-devel+...@googlegroups.com
> <mailto:blis-devel%2Bunsu...@googlegroups.com>>.
> <https://groups.google.com/d/msgid/blis-devel/28eab5d2-06e1-4b03-b001-8038a30b4a42o%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/blis-devel/28eab5d2-06e1-4b03-b001-8038a30b4a42o%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
>
> Disclaimer:This message is intended only for the designated
> recipient(s). It may contain confidential or proprietary information and
> may be subject to other confidentiality protections. If you are not a
> designated recipient, you may not review, copy or distribute this
> message. Please notify the sender by e-mail and delete this message.
> GlobalEdge does not accept any liability for virus infected mails.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blis-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blis-devel+...@googlegroups.com
> <mailto:blis-devel+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/blis-devel/ce205a6e-406f-4481-8667-f3124e865650o%40googlegroups.com
> <https://groups.google.com/d/msgid/blis-devel/ce205a6e-406f-4481-8667-f3124e865650o%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages