From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by sourceware.org (Postfix) with ESMTPS id 9C57A3840C1B for ; Fri, 29 May 2020 13:22:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9C57A3840C1B Received: by mail-il1-x144.google.com with SMTP id h3so2357426ilh.13 for ; Fri, 29 May 2020 06:22:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ec35hrYOqlQT4Hr7uYHFY1clmkgTNX06FcOAWanbwew=; b=Pu5cevIqhUGrgXw0Ps9e7IGN+vq+PUSZoTjznTWSQc1RvvCO+UxfemMBvDQvb1Qppd F+VMNP5C7ykPhgKD2OrBVuYmMRiYl/vNRYtlAMktt6d4CEHQbf9pMLRmOFHycWVPuxq4 B21H1E9nv4L/h530ubHD41lgvSd0fgSgynW8/kKxLhMWjHtCUO8aRxmNVv/je+patLWr fkEVRYiQee+0W/kTMsh3bOo6RdiTVj6DnkCn131yyFi/v2GWfmv2NN6FiyrIeCgJNZUR 7MPMn9TZMlfa2FvAVjK123sz5ZOJwg1iRIrDmLQPlu0gsaDM4AMH5dK1E3pfRvn5iyZq 0VgA== X-Gm-Message-State: AOAM5319Yhxm1PR/4sYLhIDCMPXqGDks2FIz3DSmYFjH3hMfqFftDBjK s79y6KKCgc2muKQOP8fRiibazUr9eRPBzvzQANJ8L9Zh X-Google-Smtp-Source: ABdhPJw2Zms1rB42qPFVfSgqshd0RX4rnEJANyGBNLWukb+IHlatEcf+4ktBfkMZ/q9KAQ3LnuLLlu/AddSkFTBzeDo= X-Received: by 2002:a92:5fda:: with SMTP id i87mr5068811ill.292.1590758552012; Fri, 29 May 2020 06:22:32 -0700 (PDT) MIME-Version: 1.0 References: <15ec783d-46f5-0166-aee9-f1d16a58ca83@huawei.com> In-Reply-To: From: "H.J. Lu" Date: Fri, 29 May 2020 06:21:56 -0700 Message-ID: Subject: Re: [PATCH] x86: Add thresholds for "rep movsb/stosb" to tunables To: "Carlos O'Donell" Cc: liqingqing , Hushiyuan , "libc-alpha@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 13:22:33 -0000 On Fri, May 29, 2020 at 6:13 AM Carlos O'Donell wrote: > > On 5/23/20 12:37 AM, H.J. Lu via Libc-alpha wrote: > > There is no single threshold value which is good for all workloads. > > I don't think we should change REP_STOSB_THRESHOLD to 1MB. > > On the other hand, the fixed threshold isn't flexible. Please try this > > patch to see if you can set the threshold for your specific workload. > > My request here is that the manual include a documentation of what the > minimums are for the tunable. Even an example reference of the minimum > value would be useful for the tunable e.g. On AVX512 systems this value > is X, on AVX systems this value is Y, on all other systems Z. > The logic of thresholds are: /* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8. */ unsigned int minimum_rep_movsb_threshold; /* NB: The default REP MOVSB threshold is 2048 * (VEC_SIZE / 16). */ unsigned int rep_movsb_threshold; if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable) && !CPU_FEATURES_ARCH_P (cpu_features, Prefer_No_AVX512)) { rep_movsb_threshold = 2048 * (64 / 16); minimum_rep_movsb_threshold = 64 * 8; } else if (CPU_FEATURES_ARCH_P (cpu_features, AVX_Fast_Unaligned_Load)) { rep_movsb_threshold = 2048 * (32 / 16); minimum_rep_movsb_threshold = 32 * 8; } else { rep_movsb_threshold = 2048 * (16 / 16); minimum_rep_movsb_threshold = 16 * 8; } if (cpu_features->rep_movsb_threshold > minimum_rep_movsb_threshold) __x86_rep_movsb_threshold = cpu_features->rep_movsb_threshold; else __x86_rep_movsb_threshold = rep_movsb_threshold; We can't simply say AVX512 machines will use ZMM and AVX machines will use YMM. It depends on other factors which are invisible to users. Can you suggest some paragraph for libc manual? Thanks. -- H.J.