Hi!

On 2020-06-22T11:32:46-0300, Alexandre Oliva <ol...@adacore.com> wrote:
> Here's a consolidated patch, [...]

Again, many thanks for working through this, with Tobias' help.

> --- /dev/null
> +++ b/gcc/testsuite/lib/scanoffload.exp

> +# Utility for scanning offloading dump output, used by libgomp.exp.

;-) Yeah, I was about to say that having this file in
'gcc/testsuite/lib/' seems to be a bit of an abstraction violation, given
that...

> +# Format an offload dump suffix given the offload target name in
> +# OFFTGT and any suffix, probably empty, in SUFFIX.
> +proc scoff-format { offtgt suffix } {
> +    return ".x$offtgt.mkoffload$suffix"
> +}
> +
> +# Wrapper for scan procs.
> +# Argument 0 is the index of the argument to replace when calling
> +# argument 1 with the remaining arguments.  Use end-1 or end or so.
> +proc scoff { args } {
> +    set idx [lindex $args 0]
> +    set prc [lindex $args 1]
> +    set args [lreplace $args 0 1]
> +
> +    global offload_target
> +    if [info exists offload_target] {
> +     set target $offload_target
> +     if { "$target" != "disable" } {
> +         eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex 
> $args $idx]]"]
> +     }
> +    } else {
> +     global offload_targets
> +     foreach target [split $offload_targets ","] {
> +         eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex 
> $args $idx]]"]
> +     }
> +    }
> +}

... only libgomp testing defines the 'offload_target', 'offload_targets'
variables.  But anyway, it works, and we've got worse things in GCC.  ;-)

Good idea to indirect this via 'scoff', 'scoff-format'!  This is very
explicit (good) instead of just using some wildcard file name matching --
which would especially be problematic if you've got offload code
generation configured for several offload targets.

> --- a/libgomp/testsuite/lib/libgomp-dg.exp
> +++ b/libgomp/testsuite/lib/libgomp-dg.exp
> @@ -1,12 +1,4 @@
>  proc libgomp-dg-test { prog do_what extra_tool_flags } {
> -    # Force the dumpbase for test.c to test.o, such that scan-offload-*-dump
> -    # will work.
> -    foreach opt $extra_tool_flags {
> -     if { [regexp ^-foffload=-fdump- $opt] } {
> -         lappend extra_tool_flags "-save-temps"
> -     }
> -    }
> -
>      return [gcc-dg-test-1 libgomp_target_compile $prog $do_what 
> $extra_tool_flags]
>  }

Happy to see that hack go away.


I've pushed "[testsuite] Adjust 'scoff' for HSA offloading" to master
branch in commit 01dd58659faae3d6292c458cd9cf96dfd4cf7198, see attached.
"HSA offloading is doing things differently, doesn't use 'mkoffload'", so
we have to skip it in the loop over 'offload_targets'.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
>From 01dd58659faae3d6292c458cd9cf96dfd4cf7198 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Tue, 30 Jun 2020 07:23:03 +0200
Subject: [PATCH] [testsuite] Adjust 'scoff' for HSA offloading

Fix-up for commit efc16503ca10bc0e934e0bace5777500e4dc757a "handle dumpbase in
offloading, adjust testsuite".

	gcc/testsuite/
	* lib/scanoffload.exp (scoff) <offload_targets>: Skip HSA.
---
 gcc/testsuite/lib/scanoffload.exp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/testsuite/lib/scanoffload.exp b/gcc/testsuite/lib/scanoffload.exp
index ec0d7a605eb3..1a26e44113e2 100644
--- a/gcc/testsuite/lib/scanoffload.exp
+++ b/gcc/testsuite/lib/scanoffload.exp
@@ -39,6 +39,9 @@ proc scoff { args } {
     } else {
 	global offload_targets
 	foreach target [split $offload_targets ","] {
+	    # HSA offloading is doing things differently, doesn't use 'mkoffload'.
+	    if { "$target" == "hsa" } continue
+
 	    eval $prc [lreplace $args $idx $idx "[scoff-format $target [lindex $args $idx]]"]
 	}
     }
-- 
2.27.0

Reply via email to