From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E2CB9385840C for ; Mon, 24 Oct 2022 14:07:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E2CB9385840C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666620452; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=QuSbStmhfTn0KiCYoJU257NITqCUn3ARgVXHyTil9sc=; b=E6dCPMmtp64lUNI8nRrvjoWz2Iti6oyZnXFu/LXR1q7wev/0xizLd2qQCMZpd9Yd/qAJGX ojsoUtQ2S4Gz6uiHISnHxJRSb5+mQ+B/bRvI2uPPxak7sQ8NMlkrUe6F/Ltexda/AU5OIH ca4J1bjlAkkAlcS9aGqbxgCexb0K9mw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-QWMHAkTXMAmDYVMhJjihww-1; Mon, 24 Oct 2022 10:07:31 -0400 X-MC-Unique: QWMHAkTXMAmDYVMhJjihww-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22EDC8688D7; Mon, 24 Oct 2022 14:07:31 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B44392166B2A; Mon, 24 Oct 2022 14:07:30 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 29OE7RUw3061448 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 16:07:28 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 29OE7PI73061447; Mon, 24 Oct 2022 16:07:25 +0200 Date: Mon, 24 Oct 2022 16:07:25 +0200 From: Jakub Jelinek To: Tobias Burnus Cc: Alexander Monakov , gcc-patches Subject: Re: [Patch][v5] libgomp/nvptx: Prepare for reverse-offload callback handling Message-ID: Reply-To: Jakub Jelinek References: <3f0fc49f-b07f-bee2-51a8-a5d03f1c33ed@codesourcery.com> <30e3ed49-0d14-8015-57ef-3d70b1dea69a@codesourcery.com> <3ebce406-46e4-8f98-8c53-83b61423644e@codesourcery.com> <798d7ee1-2ffa-a591-38cb-a9ad421265d0@codesourcery.com> <832946f-bb12-23d7-7d64-47b85c95125@ispras.ru> <1e56b27f-3c74-8bc2-028b-9091fa1ae7b1@codesourcery.com> MIME-Version: 1.0 In-Reply-To: <1e56b27f-3c74-8bc2-028b-9091fa1ae7b1@codesourcery.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Oct 12, 2022 at 10:55:26AM +0200, Tobias Burnus wrote: > libgomp/nvptx: Prepare for reverse-offload callback handling > > This patch adds a stub 'gomp_target_rev' in the host's target.c, which will > later handle the reverse offload. > For nvptx, it adds support for forwarding the offload gomp_target_ext call > to the host by setting values in a struct on the device and querying it on > the host - invoking gomp_target_rev on the result. > > include/ChangeLog: > > * cuda/cuda.h (enum CUdevice_attribute): Add > CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING. > (CU_MEMHOSTALLOC_DEVICEMAP): Define. > (cuMemHostAlloc): Add prototype. > > libgomp/ChangeLog: > > * config/nvptx/icv-device.c (GOMP_DEVICE_NUM_VAR): Remove > 'static' for this variable. > * config/nvptx/libgomp-nvptx.h: New file. > * config/nvptx/target.c: Include it. > (GOMP_ADDITIONAL_ICVS): Declare extern var. > (GOMP_REV_OFFLOAD_VAR): Declare var. > (GOMP_target_ext): Handle reverse offload. > * libgomp-plugin.h (GOMP_PLUGIN_target_rev): New prototype. > * libgomp-plugin.c (GOMP_PLUGIN_target_rev): New, call ... > * target.c (gomp_target_rev): ... this new stub function. > * libgomp.h (gomp_target_rev): Declare. > * libgomp.map (GOMP_PLUGIN_1.4): New; add GOMP_PLUGIN_target_rev. > * plugin/cuda-lib.def (cuMemHostAlloc): Add. > * plugin/plugin-nvptx.c: Include libgomp-nvptx.h. > (struct ptx_device): Add rev_data member. > (nvptx_open_device): Remove async_engines query, last used in > r10-304-g1f4c5b9b; add unified-address assert check. > (GOMP_OFFLOAD_get_num_devices): Claim unified address > support. > (GOMP_OFFLOAD_load_image): Free rev_fn_table if no > offload functions exist. Make offload var available > on host and device. > (rev_off_dev_to_host_cpy, rev_off_host_to_dev_cpy): New. > (GOMP_OFFLOAD_run): Handle reverse offload. Ok, thanks. Jakub