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 ESMTP id 8A9D33858400 for ; Thu, 19 Aug 2021 10:22:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A9D33858400 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=1629368548; 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=NbkC1UJEI68VaWI4JZx1px2DbnP2KYP0G0Z0ZZb6y5k=; b=JMfP4f4zmq1BFHuNhXH1XalJKgvkjbUSlMgJK20l3j7+pw2PTy/MMnALuy60rP7RO9qbU/ uaXFkdzszYX04FFYLL3dKxrghAk3SaH9xIl4LU/zKORfgyMcNMCFpgSjn3Whlhf02i2XUB DCl65pUANWeosIU+bwuVGkzejdhBtfM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-D8WSmgMEOCqDUi5g28_Gyw-1; Thu, 19 Aug 2021 06:22:26 -0400 X-MC-Unique: D8WSmgMEOCqDUi5g28_Gyw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D477190D341; Thu, 19 Aug 2021 10:22:25 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-112-10.ams2.redhat.com [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EC9710013D6; Thu, 19 Aug 2021 10:22:25 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id D0E6EA80DDB; Thu, 19 Aug 2021 12:22:23 +0200 (CEST) Date: Thu, 19 Aug 2021 12:22:23 +0200 From: Corinna Vinschen To: Roger Sayle Cc: newlib@sourceware.org Subject: Re: [PATCH] Emulate clock and other stubs on nvptx Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Roger Sayle , newlib@sourceware.org References: <010301d79450$27eb3720$77c1a560$@nextmovesoftware.com> MIME-Version: 1.0 In-Reply-To: <010301d79450$27eb3720$77c1a560$@nextmovesoftware.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=vinschen@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 10:22:38 -0000 Hi Roger, On Aug 18 17:43, Roger Sayle wrote: > > Please be gentle, this is my first patch to newlib. > > This patch to the libc/machine/nvptx port of newlib implements an > approximation of "clock" and provides some additional stub routines. > These changes not only reduce the number of (link) failures in the GCC > testsuite when targeting nvptx-none, but also allow the NIST scimark4 > benchmark to compile and run without modification. > > newlib already contains support for backends to provide their own > clock implementations via -DCLOCK_PROVIDED. That functionality is > used here to return an approximate elapsed time based on the NVidia > GPU's clock64 cycle counter. Although not great, this is better than > the current behaviour of link error from the unresolved symbol > _times_r. > > The other part of the patch is to add a small number of stub functions > to nvptx's misc.c. Adding isatty, for example, resolves linking > problems in libc from the dependency in __smakebuf_r, and the sync > stub, for example, fixes the failure with GCC's > testsuite/gfortran.dg/ISO_Fortran_binding_14.f90 [which simply tests > that gfortran can call a/any C function]. > > Hopefully, these changes are acceptable. If so, if someone could > please commit They are, but your patch submission is a bit weird and more work to apply than necessary. Please commit your patches to your local git repo, including a nice commit message, create a git patch file via `git format-patch' and send it via `git send-email --to="newlib@..." to this mailing list. Note that providing Makefile.in is nice, but you don't *have* to provide Makefile.in. We'll regenerate that as required. Another point: Given the HW support for a monotonic clock tick, wouldn't it make more sense to implement clock_gettime() with support for CLOCK_REALTIME and CLOCK_MONOTONIC, and implement clock() by calling clock_gettime()? Thanks, Corinna