From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123163 invoked by alias); 17 Dec 2019 09:23:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 123151 invoked by uid 89); 17 Dec 2019 09:23:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=H*i:sk:87v9qfy, H*f:sk:87v9qfy, agent X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Dec 2019 09:23:34 +0000 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Cc" Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A7DE5AC67; Tue, 17 Dec 2019 09:23:31 +0000 (UTC) From: Martin Jambor To: Thomas Schwinge , Frederik Harwath Cc: gcc-patches@gcc.gnu.org, jakub@redhat.com, tdevries@suse.de, Andrew Stubbs , Julian Brown , Tobias Burnus Cc: Subject: Re: [PATCH] Add OpenACC 2.6 `acc_get_property' support In-Reply-To: <87v9qfyiyz.fsf@euler.schwinge.homeip.net> References: <20191113153215.17750-1-frederik@codesourcery.com> <87imp01jr3.fsf@euler.schwinge.homeip.net> <20191114153531.7493-1-frederik@codesourcery.com> <87v9qfyiyz.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.2 (https://notmuchmail.org) Emacs/26.3 (x86_64-suse-linux-gnu) Date: Tue, 17 Dec 2019 09:39:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg01171.txt.bz2 Hi, On Tue, Dec 17 2019, Thomas Schwinge wrote: > On 2019-11-14T16:35:31+0100, Frederik Harwath wrote: >> this patch implements OpenACC 2.6 "acc_get_property" and related functions. > > [...] > >> --- a/libgomp/plugin/plugin-hsa.c >> +++ b/libgomp/plugin/plugin-hsa.c >> @@ -699,6 +699,32 @@ GOMP_OFFLOAD_get_num_devices (void) >> return hsa_context.agent_count; >> } >> >> +/* Part of the libgomp plugin interface. Return the value of property >> + PROP of agent number N. */ >> + >> +union gomp_device_property_value >> +GOMP_OFFLOAD_get_property (int n, int prop) >> +{ >> + union gomp_device_property_value nullval = { .val = 0 }; >> + >> + if (!init_hsa_context ()) >> + return nullval; > > I'm not familiar with that code, but similar to other plugins, > 'init_hsa_context' already is called via 'GOMP_OFFLOAD_get_num_devices' > (and 'GOMP_OFFLOAD_init_device', hmm...), so probably don't need to call > it here? I assume you always want to get the number of devices before querying their properties but OTOH there is no harm in calling the initialization function. >> + >> + switch (prop) >> + { >> + case GOMP_DEVICE_PROPERTY_VENDOR: >> + return (union gomp_device_property_value) { .ptr = "AMD" }; >> + default: >> + return nullval; >> + } >> +} > > Not sure if "AMD" is actually correct here -- isn't HSA a > vendor-independent standard? > Yes, it is supposed to be. I think HSA is the correct "vendor" too, essentially an abbreviation for HSA Foundation. Thanks, Martin