Fix global symbol loading failure in resolve function
PATCH 1/1 Fix global symbol loading failure in resolve function
From: Brandon Hong <[email protected]>
270 out of 284 tests get failed with SIGSEGV on ClearLinux because the ifunc resolver resolve_half_to_float() tries to call unbound global function igt_x86_features(). This patch fixes the issue by adding a F16C checking local function.
--- lib/igt_halffloat.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
lib/igt_halffloat.c +20 -2
@@ -24,6 +24,7 @@#include <assert.h> #include <math.h> +#include <stdbool.h> #include "igt_halffloat.h" #include "igt_x86.h"
@@ -163,6 +164,8 @@ static inline float _half_to_float(uint16_t val) }#if defined(__x86_64__) && !defined(__clang__) +#include <cpuid.h> +#pragma GCC push_options#pragma GCC target("f16c")
@@ -182,6 +185,20 @@ static void half_to_float_f16c(const uint16_t *h, float *f, unsigned int num)#pragma GCC pop_options +static bool f16c_is_supported (void ) +{ +unsigned max =__get_cpuid_max (0 ,NULL ); +unsigned eax, ebx, ecx, edx; + +if (max >=1 ) { +__cpuid (1 , eax, ebx, ecx, edx); + +if (ecx & bit_F16C) +return true; + } +return false; +} +static void float_to_half (const float *f,uint16_t *h,unsigned int num) {for (int i =0 ; i < num; i++)
@@ -194,9 +211,10 @@ static void half_to_float(const uint16_t *h, float *f, unsigned int num) f[i] =_half_to_float (h[i]); } +static void (*resolve_float_to_half (void ))(const float *f,uint16_t *h,unsigned int num) { -if (igt_x86_features () &F16C ) +if (f16c_is_supported ())return float_to_half_f16c;return float_to_half;
@@ -207,7 +225,7 @@ void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)static void (*resolve_half_to_float (void ))(const uint16_t *h,float *f,unsigned int num) { -if (igt_x86_features () &F16C ) +if (f16c_is_supported ())return half_to_float_f16c;return half_to_float;
Signature · 6 lines
2.23.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for Fix global symbol loading failure in resolve function (rev2)
== Series Details ==
== Series Details ==
Series: Fix global symbol loading failure in resolve function (rev2)
URL : https://patchwork.freedesktop.org/series/67150/
State : success
== Summary ==
CI Bug Log - changes from IGT_5202 -> IGTPW_3496
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/67150/revisions/2/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_3496:
### IGT changes ###
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@gem_ctx_switch@rcs0:
- {fi-tgl-u}: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/fi-tgl-u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/fi-tgl-u/igt@[email protected]
Known issues
------------
Here are the changes found in IGTPW_3496 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: [PASS][3] -> [INCOMPLETE][4] ([fdo#107718])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/fi-blb-e6850/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/fi-blb-e6850/igt@[email protected]
* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: [PASS][5] -> [DMESG-WARN][6] ([fdo#102614])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/fi-hsw-peppy/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/fi-hsw-peppy/igt@[email protected]
#### Possible fixes ####
* igt@gem_ctx_switch@rcs0:
- {fi-icl-guc}: [INCOMPLETE][7] ([fdo#107713]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/fi-icl-guc/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/fi-icl-guc/igt@[email protected]
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][9] ([fdo#111045] / [fdo#111096]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/fi-kbl-7500u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/fi-kbl-7500u/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#110566]: https://bugs.freedesktop.org/show_bug.cgi?id=110566
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
Participating hosts (53 -> 46)
------------------------------
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5202 -> IGTPW_3496
CI-20190529: 20190529
CI_DRM_6948: 485ca160d8ffac7ffb5be5e76fa12ad46a7e5a19 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3496: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/
IGT_5202: 3499c5eb17054e2abd88023fe962768140d24302 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.IGT: failure for Fix global symbol loading failure in resolve function (rev2)
In reply to [email protected]== Series Details ==
== Series Details ==
Series: Fix global symbol loading failure in resolve function (rev2)
URL : https://patchwork.freedesktop.org/series/67150/
State : failure
== Summary ==
CI Bug Log - changes from IGT_5202_full -> IGTPW_3496_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_3496_full absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_3496_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/67150/revisions/2/mbox/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_3496_full:
### IGT changes ###
#### Possible regressions ####
* igt@kms_flip@modeset-vs-vblank-race-interruptible:
- shard-snb: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-snb2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-snb4/igt@[email protected]
Known issues
------------
Here are the changes found in IGTPW_3496_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_schedule@preempt-contexts-bsd2:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#109276]) +11 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb3/igt@[email protected]
* igt@gem_exec_schedule@preempt-other-chain-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +5 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb7/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb2/igt@[email protected]
* igt@gem_tiled_swapping@non-threaded:
- shard-kbl: [PASS][7] -> [DMESG-WARN][8] ([fdo#108686])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-kbl3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-kbl6/igt@[email protected]
* igt@kms_draw_crc@draw-method-xrgb8888-pwrite-xtiled:
- shard-iclb: [PASS][9] -> [FAIL][10] ([fdo#103184] / [fdo#103232])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb6/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb5/igt@[email protected]
* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-kbl: [PASS][11] -> [DMESG-WARN][12] ([fdo#108566])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-kbl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-kbl3/igt@[email protected]
* igt@kms_flip@modeset-vs-vblank-race:
- shard-apl: [PASS][13] -> [FAIL][14] ([fdo#111609])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-apl5/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-apl5/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +8 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb8/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb2/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-wc:
- shard-glk: [PASS][17] -> [FAIL][18] ([fdo#103167])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-glk7/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-wc.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-glk6/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-wc.html
* igt@kms_psr@psr2_sprite_blt:
- shard-iclb: [PASS][19] -> [SKIP][20] ([fdo#109441]) +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb2/igt@kms_psr@psr2_sprite_blt.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb1/igt@kms_psr@psr2_sprite_blt.html
* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-apl: [PASS][21] -> [DMESG-WARN][22] ([fdo#108566]) +4 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-apl8/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-apl6/igt@[email protected]
* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-hsw: [PASS][23] -> [INCOMPLETE][24] ([fdo#103540]) +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-hsw4/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-hsw8/igt@[email protected]
#### Possible fixes ####
* igt@gem_ctx_isolation@bcs0-s3:
- shard-apl: [DMESG-WARN][25] ([fdo#108566]) -> [PASS][26] +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-apl1/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-apl3/igt@[email protected]
* igt@gem_exec_schedule@preempt-bsd1:
- shard-iclb: [SKIP][27] ([fdo#109276]) -> [PASS][28] +14 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb2/igt@[email protected]
* igt@gem_exec_schedule@wide-bsd:
- shard-iclb: [SKIP][29] ([fdo#111325]) -> [PASS][30] +5 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb2/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb5/igt@[email protected]
* igt@kms_cursor_edge_walk@pipe-c-256x256-top-edge:
- shard-apl: [TIMEOUT][31] -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-apl6/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-apl2/igt@[email protected]
* igt@kms_flip@plain-flip-ts-check-interruptible:
- shard-glk: [FAIL][33] ([fdo#100368]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-glk6/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-glk5/igt@[email protected]
- shard-hsw: [INCOMPLETE][35] ([fdo#103540]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-hsw1/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-hsw5/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
- shard-iclb: [FAIL][37] ([fdo#103167]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb7/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render.html
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-iclb: [DMESG-WARN][39] -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb4/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb6/igt@[email protected]
* igt@kms_plane@pixel-format-pipe-a-planes-source-clamping:
- shard-apl: [INCOMPLETE][41] ([fdo#103927]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-apl5/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-apl6/igt@[email protected]
* igt@kms_psr@no_drrs:
- shard-iclb: [FAIL][43] ([fdo#108341]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb1/igt@kms_psr@no_drrs.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb2/igt@kms_psr@no_drrs.html
* igt@kms_psr@psr2_cursor_plane_onoff:
- shard-iclb: [SKIP][45] ([fdo#109441]) -> [PASS][46] +2 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-iclb1/igt@kms_psr@psr2_cursor_plane_onoff.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-iclb2/igt@kms_psr@psr2_cursor_plane_onoff.html
* igt@perf_pmu@cpu-hotplug:
- shard-apl: [DMESG-WARN][47] -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5202/shard-apl6/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/shard-apl8/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#100368]: https://bugs.freedesktop.org/show_bug.cgi?id=100368
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111609]: https://bugs.freedesktop.org/show_bug.cgi?id=111609
[fdo#111795 ]: https://bugs.freedesktop.org/show_bug.cgi?id=111795
Participating hosts (7 -> 6)
------------------------------
Missing (1): shard-skl
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5202 -> IGTPW_3496
CI-20190529: 20190529
CI_DRM_6948: 485ca160d8ffac7ffb5be5e76fa12ad46a7e5a19 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3496: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/
IGT_5202: 3499c5eb17054e2abd88023fe962768140d24302 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3496/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 6 lines · On Tue, Sep 24, 2019 at 10:02:29PM +0800, [email protected] wrote:
From: Brandon Hong <[email protected]>
270 out of 284 tests get failed with SIGSEGV on ClearLinux because the ifunc resolver
resolve_half_to_float()tries to call unbound global functionigt_x86_features(). This patch fixes the issue by adding a F16C checking local function.
The rules for this stuff seem to be poorly documented. But I did find some docs that support this. So generally lgtm, just a few nitpicks below...
Quoted 19 lines
Signed-off-by Brandon Hong <[email protected]>--- lib/igt_halffloat.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)lib/igt_halffloat.c +1
-0@@ -24,6 +24,7 @@#include <assert.h> #include <math.h> +#include <stdbool.h> #include "igt_halffloat.h" #include "igt_x86.h"
lib/igt_halffloat.c static inline float _half_to_float(uint16_t val) · line 167
Quoted 4 lines
lib/igt_halffloat.c +1
-0@@ -163,6 +164,8 @@ static inline float _half_to_float(uint16_t val) }#if defined(__x86_64__) && !defined(__clang__) +#include <cpuid.h>
igt_x86.c has HAVE_CPUID_H protection around this stuff. I suppose we'd want the same here?
Quoted 26 lines
lib/igt_halffloat.c +15
-0+#pragma GCC push_options#pragma GCC target("f16c")@@ -182,6 +185,20 @@ static void half_to_float_f16c(const uint16_t *h, float *f, unsigned int num)#pragma GCC pop_options +static bool f16c_is_supported (void ) +{ +unsigned max =__get_cpuid_max (0 ,NULL ); +unsigned eax, ebx, ecx, edx; + +if (max >=1 ) { +__cpuid (1 , eax, ebx, ecx, edx); + +if (ecx & bit_F16C) +return true; + } +return false; +} +static void float_to_half (const float *f,uint16_t *h,unsigned int num) {for (int i =0 ; i < num; i++)
lib/igt_halffloat.c static void half_to_float(const uint16_t *h, float *f, unsigned int num) · line 214
Quoted 4 lines
lib/igt_halffloat.c +1
-0@@ -194,9 +211,10 @@ static void half_to_float(const uint16_t *h, float *f, unsigned int num) f[i] =_half_to_float (h[i]); } +
Spurious newline.
Quoted 23 lines
lib/igt_halffloat.c +2
-2static void (*resolve_float_to_half (void ))(const float *f,uint16_t *h,unsigned int num) { -if (igt_x86_features () &F16C ) +if (f16c_is_supported ())return float_to_half_f16c;return float_to_half;@@ -207,7 +225,7 @@ void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)static void (*resolve_half_to_float (void ))(const uint16_t *h,float *f,unsigned int num) { -if (igt_x86_features () &F16C ) +if (f16c_is_supported ())return half_to_float_f16c;return half_to_float;Signature · 6 lines
2.23.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 37 lines · Ville Syrjälä
Quoted 6 lines · On Tue, Sep 24, 2019 at 10:02:29PM +0800, [email protected] wrote:
From: Brandon Hong <[email protected]>
270 out of 284 tests get failed with SIGSEGV on ClearLinux because the ifunc resolver
resolve_half_to_float()tries to call unbound global functionigt_x86_features(). This patch fixes the issue by adding a F16C checking local function.The rules for this stuff seem to be poorly documented. But I did find some docs that support this. So generally lgtm, just a few nitpicks below…
Quoted 21 lines
Signed-off-by Brandon Hong <[email protected]>---
lib/igt_halffloat.c| 22 ++++++++++++++++++++--1 file changed, 20 insertions(+), 2 deletions(-)lib/igt_halffloat.c +1
-0@@ -24,6 +24,7 @@#include <assert.h> #include <math.h> +#include <stdbool.h> #include "igt_halffloat.h" #include "igt_x86.h" @@ -163,6 +164,8 @@ static inline float _half_to_float(uint16_t val) }
Quoted 5 lines
lib/igt_halffloat.c static inline float _half_to_float(uint16_t val) · line 167
Quoted 2 lines
lib/igt_halffloat.c +1
-0#if defined(__x86_64__) && !defined(__clang__) +#include <cpuid.h>
igt_x86.chasHAVE_CPUID_Hprotection around this stuff. I suppose we'd want the same here?
Thanks for pointing it out. Will add HAVE_CPUID_H as same as igt_x86.c file.
Quoted 30 lines
Quoted 30 lines
lib/igt_halffloat.c +15
-0+#pragma GCC push_options#pragma GCC target("f16c")@@ -182,6 +185,20 @@ static void half_to_float_f16c(const uint16_t *h, float *f, unsigned int num)#pragma GCC pop_options +static bool f16c_is_supported (void ) +{ +unsigned max =__get_cpuid_max (0 ,NULL ); +unsigned eax, ebx, ecx, edx; + +if (max >=1 ) { +__cpuid (1 , eax, ebx, ecx, edx); + +if (ecx & bit_F16C) +return true; + } +return false; +} +static void float_to_half (const float *f,uint16_t *h,unsigned int num) {for (int i =0 ; i < num; i++)@@ -194,9 +211,10 @@ static void half_to_float(const uint16_t *h, float *f, unsigned int num) f[i] =_half_to_float (h[i]); }
Quoted 3 lines
lib/igt_halffloat.c static void half_to_float(const uint16_t *h, float *f, unsigned int num) · line 214
Quoted 1 line
lib/igt_halffloat.c +1
-0+Spurious newline.
Will remove it and re-submit.
Quoted 16 lines
Quoted 16 lines
lib/igt_halffloat.c +2
-2static void (*resolve_float_to_half (void ))(const float *f,uint16_t *h,unsigned int num) { -if (igt_x86_features () &F16C ) +if (f16c_is_supported ())return float_to_half_f16c;return float_to_half;@@ -207,7 +225,7 @@ void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)static void (*resolve_half_to_float (void ))(const uint16_t *h,float *f,unsigned int num) { -if (igt_x86_features () &F16C ) +if (f16c_is_supported ())return half_to_float_f16c;
Quoted 12 lines
Quoted 8 lines
lib/igt_halffloat.c +0
-0return half_to_float;Signature · 6 lines
2.23.0 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-devSignature · 2 lines
Ville Syrjälä Intel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev