Skip to contentSkip to conversation

drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines

PATCH In review [email protected] 6 participants 8 messages Jan 25, 2019 – Jan 29, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: add -msse2 to prevent Clang from emitting libcalls to undefined SW FP routines

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
index d97ca6528f9d..33c7d7588712 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)
Signature · 1 line
2.20.1.321.g9e740568ce-goog
Tested-by on v1 1/1
#1 lore raw
Quoted 38 lines · On Thu, Jan 24, 2019 at 04:52:59PM -0800, [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -0
index d97ca6528f9d..33c7d7588712 100644

drivers/gpu/drm/amd/display/dc/dml/Makefile else ifneq ($(call cc-option, -mstack-alignment=16),) · line 36

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)
Tested-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Thu, Jan 24, 2019 at 04:52:59PM -0800, [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

Quoted 9 lines
Quoted 34 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
index d97ca6528f9d..33c7d7588712 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)
Signature · 1 line
2.20.1.321.g9e740568ce-goog
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 6 lines · On 2019-01-24 7:52 p.m., [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

Quoted 9 lines

and applied.

Harry

Quoted 24 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -0
index d97ca6528f9d..33c7d7588712 100644

drivers/gpu/drm/amd/display/dc/dml/Makefile else ifneq ($(call cc-option, -mstack-alignment=16),) · line 36

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
 	cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw
Quoted 18 lines · Harry
Quoted 6 lines · On 2019-01-24 7:52 p.m., [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

Quoted 9 lines
Quoted 4 lines

and applied.

This patch causes a segfault:
https://bugs.freedesktop.org/show_bug.cgi?id=109487

Any ideas?

Alex

Quoted 31 lines

Harry

Quoted 29 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
index d97ca6528f9d..33c7d7588712 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
Quoted 7 lines

drivers/gpu/drm/amd/display/dc/dml/Makefile else ifneq ($(call cc-option, -mstack-alignment=16),) · line 36

Quoted 3 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -0
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw
Quoted 21 lines · Alex Deucher
Quoted 20 lines · Harry
Quoted 6 lines · On 2019-01-24 7:52 p.m., [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

and applied.

This patch causes a segfault:
https://bugs.freedesktop.org/show_bug.cgi?id=109487

Any ideas?

Set -msse2 only for clang ? I suspect, though, that this might only solve the compile problem. If I understand correctly, the first warning in the log is due to BREAK_TO_DEBUGGER(), suggesting that something is seriously wrong. Maybe enabling sse2 results in different results from floating point operations.

Unfortunately I don't have a system with the affected GPU, so I can't run any tests on real hardware. Unless someone can test with real hardware, I think we have no choice but to revert the patch.

Guenter

Quoted 40 lines

Alex

Quoted 38 lines

Harry

Quoted 24 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -0
index d97ca6528f9d..33c7d7588712 100644

drivers/gpu/drm/amd/display/dc/dml/Makefile else ifneq ($(call cc-option, -mstack-alignment=16),) · line 36

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#6 lore raw
Quoted 37 lines · Guenter Roeck
Quoted 21 lines · Alex Deucher
Quoted 20 lines · Harry
Quoted 6 lines · On 2019-01-24 7:52 p.m., [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

and applied.

This patch causes a segfault:
https://bugs.freedesktop.org/show_bug.cgi?id=109487

Any ideas?

Set -msse2 only for clang ? I suspect, though, that this might only solve the compile problem. If I understand correctly, the first warning in the log is due to BREAK_TO_DEBUGGER(), suggesting that something is seriously wrong. Maybe enabling sse2 results in different results from floating point operations.

Quoted 5 lines

Unfortunately I don't have a system with the affected GPU, so I can't run any tests on real hardware. Unless someone can test with real hardware, I think we have no choice but to revert the patch.

Might be a good idea. Even though, best to revert for now until we understand what's going on.

It seems like people at AMD building with gcc 5.4 are fine, but those using gcc 7.3 or 8.2 experience the crash.

Harry

Quoted 42 lines

Guenter

Quoted 40 lines

Alex

Quoted 38 lines

Harry

Quoted 24 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -0
index d97ca6528f9d..33c7d7588712 100644

drivers/gpu/drm/amd/display/dc/dml/Makefile else ifneq ($(call cc-option, -mstack-alignment=16),) · line 36

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

Suggestions:
1. revert patch
2. get me the disassembly from gcc of the translation unit in question.
3. land patch that adds clang guards or something different based on 2.

Revert first; ask questions later.

Quoted 93 lines · Harry
Quoted 37 lines · Guenter Roeck
Quoted 21 lines · Alex Deucher
Quoted 20 lines · Harry
Quoted 6 lines · On 2019-01-24 7:52 p.m., [email protected] wrote:

arch/x86/Makefile disables SSE and SSE2 for the whole kernel. The AMDGPU drivers modified in this patch re-enable SSE but not SSE2. Turn on SSE2 to support emitting double precision floating point instructions rather than calls to non-existent (usually available from gcc_s or compiler_rt) floating point helper routines.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

and applied.

This patch causes a segfault:
https://bugs.freedesktop.org/show_bug.cgi?id=109487

Any ideas?

Set -msse2 only for clang ? I suspect, though, that this might only solve the compile problem. If I understand correctly, the first warning in the log is due to BREAK_TO_DEBUGGER(), suggesting that something is seriously wrong. Maybe enabling sse2 results in different results from floating point operations.

Quoted 5 lines

Unfortunately I don't have a system with the affected GPU, so I can't run any tests on real hardware. Unless someone can test with real hardware, I think we have no choice but to revert the patch.

Might be a good idea. Even though, best to revert for now until we understand what's going on.

It seems like people at AMD building with gcc 5.4 are fine, but those using gcc 7.3 or 8.2 experience the crash.

Harry

Quoted 42 lines

Guenter

Quoted 40 lines

Alex

Quoted 38 lines

Harry

Quoted 24 lines
---
 drivers/gpu/drm/amd/display/dc/calcs/Makefile | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +1 -1
index 95f332ee3e7e..dc85a3c088af 100644
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-calcs_ccflags := -mhard-float -msse $(cc_stack_align)
+calcs_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_dcn_calc_auto.o := $(calcs_ccflags)
drivers/gpu/drm/amd/display/dc/dml/Makefile +0 -0
index d97ca6528f9d..33c7d7588712 100644

drivers/gpu/drm/amd/display/dc/dml/Makefile else ifneq ($(call cc-option, -mstack-alignment=16),) · line 36

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -1
@@ -30,7 +30,7 @@ else ifneq ($(call cc-option, -mstack-alignment=16),)
      cc_stack_align := -mstack-alignment=16
 endif
 
-dml_ccflags := -mhard-float -msse $(cc_stack_align)
+dml_ccflags := -mhard-float -msse -msse2 $(cc_stack_align)
 
 CFLAGS_display_mode_lib.o := $(dml_ccflags)
 CFLAGS_display_pipe_clocks.o := $(dml_ccflags)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Signature · 2 lines
Thanks,
~Nick Desaulniers