From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4795 invoked by alias); 18 Dec 2015 14:41:57 -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 4781 invoked by uid 89); 18 Dec 2015 14:41:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=tus, emission, xstr, XSTR X-HELO: mail-qk0-f182.google.com Received: from mail-qk0-f182.google.com (HELO mail-qk0-f182.google.com) (209.85.220.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 18 Dec 2015 14:41:55 +0000 Received: by mail-qk0-f182.google.com with SMTP id p187so111879507qkd.1 for ; Fri, 18 Dec 2015 06:41:54 -0800 (PST) X-Received: by 10.55.71.143 with SMTP id u137mr5457039qka.1.1450449712528; Fri, 18 Dec 2015 06:41:52 -0800 (PST) Received: from ?IPv6:2601:181:c000:c497:a2a8:cdff:fe3e:b48? ([2601:181:c000:c497:a2a8:cdff:fe3e:b48]) by smtp.googlemail.com with ESMTPSA id 4sm6953181qkx.18.2015.12.18.06.41.51 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Dec 2015 06:41:52 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: [PTX] stop special casing worker buffers Message-ID: <56741B2F.7000300@acm.org> Date: Fri, 18 Dec 2015 14:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070809030301000407050104" X-SW-Source: 2015-12/txt/msg01888.txt.bz2 This is a multi-part message in MIME format. --------------070809030301000407050104 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 257 This patch removes the special case instructions for handling the worker broadcast buffer. Also commonizes the emission of the reduction and broadcast buffer variables. This is a step towards merging the convaddr instruction into a regular mov. nathan --------------070809030301000407050104 Content-Type: text/x-patch; name="trunk-ptx-worker.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="trunk-ptx-worker.patch" Content-length: 5251 2015-12-18 Nathan Sidwell * config/nvptx/nvptx.c (worker_bcast_name, worker_red_name): Delete. (nvptx_option_override): Adjust worker symbol creation. (nvptx_gen_wcast): Wrap worker address in UNSPEC_TO_GENERIC. (write_worker_buffer): New. (nvptx_file_end): Call write_worker_buffer. * config/nvptx/nvptx.md (UNSPEC_SHARED_DATA): Delete. (worker_load, worker_store): Delete. Index: config/nvptx/nvptx.c =================================================================== --- config/nvptx/nvptx.c (revision 231815) +++ config/nvptx/nvptx.c (working copy) @@ -128,14 +128,12 @@ static GTY((cache)) hash_table::create_ggc (17); - worker_bcast_sym = gen_rtx_SYMBOL_REF (Pmode, worker_bcast_name); + worker_bcast_sym = gen_rtx_SYMBOL_REF (Pmode, "__worker_bcast"); SET_SYMBOL_DATA_AREA (worker_bcast_sym, DATA_AREA_SHARED); worker_bcast_align = GET_MODE_ALIGNMENT (SImode) / BITS_PER_UNIT; - worker_red_sym = gen_rtx_SYMBOL_REF (Pmode, worker_red_name); + worker_red_sym = gen_rtx_SYMBOL_REF (Pmode, "__worker_red"); SET_SYMBOL_DATA_AREA (worker_red_sym, DATA_AREA_SHARED); worker_red_align = GET_MODE_ALIGNMENT (SImode) / BITS_PER_UNIT; } @@ -1382,7 +1380,6 @@ nvptx_gen_wcast (rtx reg, propagate_mask } addr = gen_rtx_MEM (mode, addr); - addr = gen_rtx_UNSPEC (mode, gen_rtvec (1, addr), UNSPEC_SHARED_DATA); if (pm == PM_read) res = gen_rtx_SET (addr, reg); else if (pm == PM_write) @@ -3356,9 +3353,11 @@ nvptx_wpropagate (bool pre_p, basic_bloc if (data.offset) { /* Stuff was emitted, initialize the base pointer now. */ - rtx init = gen_rtx_SET (data.base, worker_bcast_sym); + rtx init = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, worker_bcast_sym), + UNSPEC_TO_GENERIC); + init = gen_rtx_SET (data.base, init); emit_insn_after (init, insn); - + if (worker_bcast_size < data.offset) worker_bcast_size = data.offset; } @@ -3922,6 +3921,18 @@ nvptx_file_start (void) fputs ("// END PREAMBLE\n", asm_out_file); } +/* Emit a declaration for a worker-level buffer in .shared memory. */ + +static void +write_worker_buffer (FILE *file, rtx sym, unsigned align, unsigned size) +{ + const char *name = XSTR (sym, 0); + + write_var_marker (file, true, false, name); + fprintf (file, ".shared .align %d .u8 %s[%d];\n", + align, name, size); +} + /* Write out the function declarations we've collected and declare storage for the broadcast buffer. */ @@ -3935,30 +3946,12 @@ nvptx_file_end (void) fputs (func_decls.str().c_str(), asm_out_file); if (worker_bcast_size) - { - /* Define the broadcast buffer. */ - - worker_bcast_size = (worker_bcast_size + worker_bcast_align - 1) - & ~(worker_bcast_align - 1); - - write_var_marker (asm_out_file, true, false, worker_bcast_name); - fprintf (asm_out_file, ".shared .align %d .u8 %s[%d];\n", - worker_bcast_align, - worker_bcast_name, worker_bcast_size); - } + write_worker_buffer (asm_out_file, worker_bcast_sym, + worker_bcast_align, worker_bcast_size); if (worker_red_size) - { - /* Define the reduction buffer. */ - - worker_red_size = ((worker_red_size + worker_red_align - 1) - & ~(worker_red_align - 1)); - - write_var_marker (asm_out_file, true, false, worker_red_name); - fprintf (asm_out_file, ".shared .align %d .u8 %s[%d];\n", - worker_red_align, - worker_red_name, worker_red_size); - } + write_worker_buffer (asm_out_file, worker_red_sym, + worker_red_align, worker_red_size); } /* Expander for the shuffle builtins. */ Index: config/nvptx/nvptx.md =================================================================== --- config/nvptx/nvptx.md (revision 231815) +++ config/nvptx/nvptx.md (working copy) @@ -39,8 +39,6 @@ UNSPEC_DIM_SIZE - UNSPEC_SHARED_DATA - UNSPEC_BIT_CONV UNSPEC_SHUFFLE @@ -1193,20 +1191,6 @@ "" "%.\\tmov.b64\\t%0, {%1,%2};") -(define_insn "worker_load" - [(set (match_operand:SDISDFM 0 "nvptx_register_operand" "=R") - (unspec:SDISDFM [(match_operand:SDISDFM 1 "memory_operand" "m")] - UNSPEC_SHARED_DATA))] - "" - "%.\\tld.shared%u0\\t%0, %1;") - -(define_insn "worker_store" - [(set (unspec:SDISDFM [(match_operand:SDISDFM 1 "memory_operand" "=m")] - UNSPEC_SHARED_DATA) - (match_operand:SDISDFM 0 "nvptx_register_operand" "R"))] - "" - "%.\\tst.shared%u1\\t%1, %0;") - ;; Atomic insns. (define_expand "atomic_compare_and_swap" --------------070809030301000407050104--