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 7DADE3858400 for ; Thu, 19 Aug 2021 10:34:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7DADE3858400 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=1629369250; 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=k1Fy98I+g9dcqSER1NayPYs0MY0yMAC+t/lMXD4i33A=; b=EccnqArVHs+2+kwLxnTa2FBr/J0TQXsjbsnMGB3KTyZwJVemkBpjWnuROg19EFu1/Q7HZ5 TWIbUWuJP4DnLC7Tb/pn9Z6x6WkTTom8dYvQ4vfIxf9twgVusStNeVrNVOrjgh+DMzGyMR 3FsGQYCned8tmxtCKEw87fm2nyaiHZs= 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-482-vx9cTwnpMiiEau7L4IziEQ-1; Thu, 19 Aug 2021 06:34:08 -0400 X-MC-Unique: vx9cTwnpMiiEau7L4IziEQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E3F291020C20; Thu, 19 Aug 2021 10:34:07 +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 B71F560657; Thu, 19 Aug 2021 10:34:07 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 50ED2A80DDB; Thu, 19 Aug 2021 12:34:06 +0200 (CEST) Date: Thu, 19 Aug 2021 12:34:06 +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: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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:34:20 -0000 On Aug 19 12:22, Corinna Vinschen wrote: > 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()? Oh, btw., since your comment enumerates the CPU variants, isn't there a runtime method to check the CPU and use more accurate values per CPU? Just an idea... Corinna