From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62594 invoked by alias); 2 Jun 2017 11:51:43 -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 62445 invoked by uid 89); 2 Jun 2017 11:51:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Strong, seed, fly, classified X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0076.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.76) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Jun 2017 11:51:27 +0000 Received: from VI1PR0802MB2176.eurprd08.prod.outlook.com (10.172.12.21) by VI1PR0802MB2174.eurprd08.prod.outlook.com (10.172.12.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Fri, 2 Jun 2017 11:51:27 +0000 Received: from VI1PR0802MB2176.eurprd08.prod.outlook.com ([fe80::2dae:8af1:7884:bb6d]) by VI1PR0802MB2176.eurprd08.prod.outlook.com ([fe80::2dae:8af1:7884:bb6d%18]) with mapi id 15.01.1143.010; Fri, 2 Jun 2017 11:51:27 +0000 From: Bin Cheng To: "gcc-patches@gcc.gnu.org" CC: nd Subject: [PATCH GCC][4/5]Improve loop distribution to handle hmmer Date: Fri, 02 Jun 2017 11:51:00 -0000 Message-ID: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0802MB2174;7:BXtI6OTJi4uHgMVKcAXgmvNV9lpPY/fgixWB4x+1AYoYAW4nF/e3KDeO5fbTeAfdx3SSOLFdlX77d654EzmE7g+oIt69U3vu4B9S7X8WRkQ3YSew29W0S1OTZ7w416++vQU1qS1c2NiXKUCHzhZlKJsl1Cg6Hp54HBtaa3Do/wWQaoDgD3VWKVEjmgAag5Zn+q3MPm9WlNgA995rbPkhMWEfk2ZhqWUmJ5luAWgZGX4e/SVWQFBEF/mDCfMKDBsJd3ZbndMPVUrhmQB8i8PFyC+p8q9813zmG/fJOCtK/DMoucVr20UNUzda8BhtmsyaIlQIC8JWAFTBP5I0+TXxLA== x-ms-traffictypediagnostic: VI1PR0802MB2174: x-ms-office365-filtering-correlation-id: 3dc6369e-9847-40dd-1575-08d4a9adb383 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:VI1PR0802MB2174; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR0802MB2174;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR0802MB2174; x-forefront-prvs: 03264AEA72 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39400400002)(39860400002)(39450400003)(39850400002)(39410400002)(39840400002)(377424004)(2351001)(99936001)(50986999)(6916009)(5660300001)(3660700001)(7736002)(54356999)(3280700002)(53936002)(7696004)(8936002)(38730400002)(25786009)(81166006)(110136004)(8676002)(478600001)(66066001)(305945005)(74316002)(55016002)(2501003)(5250100002)(2906002)(9686003)(14454004)(189998001)(72206003)(3846002)(4326008)(99286003)(6506006)(2900100001)(102836003)(6116002)(6436002)(33656002)(86362001)(5640700003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0802MB2174;H:VI1PR0802MB2176.eurprd08.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/mixed; boundary="_002_VI1PR0802MB2176D6EF8010E74F69340CD1E7F70VI1PR0802MB2176_" MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jun 2017 11:51:27.0668 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2174 X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00123.txt.bz2 --_002_VI1PR0802MB2176D6EF8010E74F69340CD1E7F70VI1PR0802MB2176_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 6601 Hi, This is the main patch of the change. It improves loop distribution by ver= sioning loop under runtime alias check conditions, as well as better partition fusion. As des= cribed in comments, the patch basically implements distribution in the following steps: 1) Seed partitions with specific type statements. For now we support two types seed statements: statement defining variable used outside of loop; statement storing to memory. 2) Build reduced dependence graph (RDG) for loop to be distributed. The vertices (RDG:V) model all statements in the loop and the edges (RDG:E) model flow and control dependences between statements. 3) Apart from RDG, compute data dependences between memory references. 4) Starting from seed statement, build up partition by adding depended statements according to RDG's dependence information. Partition is classified as parallel type if it can be executed parallelly; or as sequential type if it can't. Parallel type partition is further classified as different builtin kinds if it can be implemented as builtin function calls. 5) Build partition dependence graph (PG) based on data dependences. The vertices (PG:V) model all partitions and the edges (PG:E) model all data dependences between every partitions pair. In general, data dependence is either compilation time known or unknown. In C family languages, there exists quite amount compilation time unknown dependences because of possible alias relation of data references. We categorize PG's edge to two types: "true" edge that represents compilation time known data dependences; "alias" edge for all other data dependences. 6) Traverse subgraph of PG as if all "alias" edges don't exist. Merge partitions in each strong connected commponent (SCC) correspondingly. Build new PG for merged partitions. 7) Traverse PG again and this time with both "true" and "alias" edges included. We try to break SCCs by removing some edges. Because SCCs by "true" edges are all fused in step 6), we can break SCCs by removing some "alias" edges. It's NP-hard to choose optimal edge set, fortunately simple approximation is good enough for us given the small problem scale. 8) Collect all data dependences of the removed "alias" edges. Create runtime alias checks for collected data dependences. 9) Version loop under the condition of runtime alias checks. Given loop distribution generally introduces additional overhead, it is only useful if vectorization is achieved in distributed loop. We version loop with internal function call IFN_LOOP_DIST_ALIAS. If no distributed loop can be vectorized, we simply remove distributed loops and recover to the original one. Also, there are some more to improve in the future (which shouldn't be diff= icult): TODO: 1) We only distribute innermost loops now. This pass should handle lo= op nests in the future. 2) We only fuse partitions in SCC now. A better fusion algorithm is desired to minimize loop overhead, maximize parallelism and maximize This patch also fixes couple of latent bugs in the original implementation. After this change, kernel loop in hmmer can be distributed and vectorized a= s a result. This gives obvious performance improvement. There is still inefficient cod= e generation issue which I will try to fix in loop split. Apart from this, the next opp= ortunity in hmmer is to eliminate number of dead stores under proper alias information. Bootstrap and test at O2/O3 on x86_64 and AArch64. is it OK? Thanks, bin 2017-05-31 Bin Cheng * cfgloop.h (struct loop): New field ldist_alias_id. * cfgloopmanip.c (lv_adjust_loop_entry_edge): Refine comment for new internal function. * internal-fn.c (expand_LOOP_DIST_ALIAS): New function. * internal-fn.def (IFN_LOOP_DIST_ALIAS): New internal function. * tree-loop-distribution.c: Add general explanantion on the pass. Include header file. (struct ddr_entry, struct ddr_entry_hasher): New structs. (ddr_entry_hasher::hash, ddr_entry_hasher::equal): New functions. (bb_top_order_index, bb_top_order_index_size): New static vars. (bb_top_order_cmp): New function. (stmts_from_loop): Get basic blocks in topological order. Don't free data references. (build_rdg): New parameter pointing to vector of data references. Store data references in it. (enum partition_type): New enum. (enum partition_kind, struct partition): Add comments. New fields. (partition_alloc, partition_free): Handle new fields of partition. (enum fuse_type, fuse_message): New enum and varaible. (partition_merge_into): New parameter. Update implementation wrto new fields of partition. (generate_loops_for_partition): Set ldist_alias_id information. (record_ddr, get_ddr, possible_data_dep_cycle_p): New functions. (build_rdg_partition_for_vertex): New parameter. Compute type info for partition. (classify_partition): New parameter. Only classify partition as reduction if the reduction is not included by all partitions. Retrieve cached ddr, rather than compute it on the fly. (ref_base_address): Delete. (similar_memory_accesses): Rename to ... (share_memory_accesses): ... this. (rdg_build_partitions): New parameter and update uses. (pg_add_dependence_edges): New parameter. Store ddr in parameter vector if it could be resolved by runtime alias check. (rdg_compute_data_dependence): New function. (struct pg_vdata, pg_edata, pg_edge_callback_data): New structs. (init_partition_graph_vertices, add_partition_graph_edge): New. (pg_skip_alias_edge, free_partition_graph_edata_cb): New. (free_partition_graph_vdata, build_partition_graph): New. (sort_partitions_by_post_order, merge_dep_scc_partitions): New. (pg_collect_alias_ddrs, break_alias_scc_partitions): New. (data_ref_segment_size, latch_dominated_by_data_ref): New. (compute_alias_check_pairs, version_loop_by_alias_check): New. (version_for_distribution_p, finalize_partitions): New. (distribute_loop): Update uses. Break SCC and version loop with runtime alias checks. (pass_loop_distribution::execute): Compute topological order for basic blocks. Update uses. * tree-vectorizer.c (vect_loop_dist_alias_call): New. (fold_loop_dist_alias_call): New. (vectorize_loops): Fold IFN_LOOP_DIST_ALIAS call depending on successful vectorization or not. gcc/testsuite/ChangeLog 2017-05-31 Bin Cheng * gcc.dg/tree-ssa/ldist-4.c: Adjust test string. * gcc.dg/tree-ssa/ldist-12.c: Ditto. * gcc.dg/tree-ssa/ldist-13.c: Ditto. * gcc.dg/tree-ssa/ldist-14.c: Ditto.= --_002_VI1PR0802MB2176D6EF8010E74F69340CD1E7F70VI1PR0802MB2176_ Content-Type: text/x-patch; name="0004-loop-distribution-20170526.txt.patch" Content-Description: 0004-loop-distribution-20170526.txt.patch Content-Disposition: attachment; filename="0004-loop-distribution-20170526.txt.patch"; size=71796; creation-date="Fri, 02 Jun 2017 10:41:56 GMT"; modification-date="Fri, 02 Jun 2017 10:41:56 GMT" Content-Transfer-Encoding: base64 Content-length: 97324 RnJvbSA1MTYzM2RkMDk2MzU4YjQyNjcyYzQyYWIwMWE0MGNmMzM3OWMzNmQ5 IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBhbWtlciA8YW1rZXJA YW1rZXItbGFwdG9wLihub25lKT4KRGF0ZTogTW9uLCAyOSBNYXkgMjAxNyAy MTozMTowOSArMDgwMApTdWJqZWN0OiBbUEFUQ0ggNC81XSBsb29wLWRpc3Ry aWJ1dGlvbi0yMDE3MDUyNi50eHQKCi0tLQogZ2NjL2NmZ2xvb3AuaCAgICAg ICAgICAgICAgICAgICAgICAgICAgICB8ICAgIDkgKwogZ2NjL2NmZ2xvb3Bt YW5pcC5jICAgICAgICAgICAgICAgICAgICAgICB8ICAgIDMgKy0KIGdjYy9p bnRlcm5hbC1mbi5jICAgICAgICAgICAgICAgICAgICAgICAgfCAgICA4ICsK IGdjYy9pbnRlcm5hbC1mbi5kZWYgICAgICAgICAgICAgICAgICAgICAgfCAg ICAxICsKIGdjYy90ZXN0c3VpdGUvZ2NjLmRnL3RyZWUtc3NhL2xkaXN0LTEy LmMgfCAgICAzICstCiBnY2MvdGVzdHN1aXRlL2djYy5kZy90cmVlLXNzYS9s ZGlzdC0xMy5jIHwgICAgNSArLQogZ2NjL3Rlc3RzdWl0ZS9nY2MuZGcvdHJl ZS1zc2EvbGRpc3QtMTQuYyB8ICAgIDUgKy0KIGdjYy90ZXN0c3VpdGUvZ2Nj LmRnL3RyZWUtc3NhL2xkaXN0LTQuYyAgfCA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DA7IHBh cnRpdGlvbjItPndyaXRlcy5pdGVyYXRlIChqLCAmZHIyKTsgKytqKQorCXsK KwkgIGlmICghRFJfQkFTRV9BRERSRVNTIChkcjIpCisJICAgICAgfHwgIURS X09GRlNFVCAoZHIyKSB8fCAhRFJfSU5JVCAoZHIyKSB8fCAhRFJfU1RFUCAo ZHIyKSkKKwkgICAgY29udGludWU7CisKKwkgIGlmIChvcGVyYW5kX2VxdWFs X3AgKERSX0JBU0VfQUREUkVTUyAoZHIxKSwgRFJfQkFTRV9BRERSRVNTIChk cjIpLCAwKQorCSAgICAgICYmIG9wZXJhbmRfZXF1YWxfcCAoRFJfT0ZGU0VU IChkcjEpLCBEUl9PRkZTRVQgKGRyMiksIDApCisJICAgICAgJiYgb3BlcmFu ZF9lcXVhbF9wIChEUl9JTklUIChkcjEpLCBEUl9JTklUIChkcjIpLCAwKQor CSAgICAgICYmIG9wZXJhbmRfZXF1YWxfcCAoRFJfU1RFUCAoZHIxKSwgRFJf U1RFUCAoZHIyKSwgMCkpCisJICAgIHJldHVybiB0cnVlOworCX0KKyAgICB9 CisKKyAgZm9yIChpID0gMDsgcGFydGl0aW9uMS0+d3JpdGVzLml0ZXJhdGUg KGksICZkcjEpOyArK2kpCisgICAgeworICAgICAgaWYgKCFEUl9CQVNFX0FE RFJFU1MgKGRyMSkKKwkgIHx8ICFEUl9PRkZTRVQgKGRyMSkgfHwgIURSX0lO SVQgKGRyMSkgfHwgIURSX1NURVAgKGRyMSkpCisJY29udGludWU7CisKKyAg ICAgIGZvciAoaiA9IDA7IHBhcnRpdGlvbjItPnJlYWRzLml0ZXJhdGUgKGos ICZkcjIpOyArK2opCisJeworCSAgaWYgKCFEUl9CQVNFX0FERFJFU1MgKGRy MikKKwkgICAgICB8fCAhRFJfT0ZGU0VUIChkcjIpIHx8ICFEUl9JTklUIChk cjIpIHx8ICFEUl9TVEVQIChkcjIpKQorCSAgICBjb250aW51ZTsKIAorCSAg aWYgKG9wZXJhbmRfZXF1YWxf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CisJICAg IGlmIChwZy0+dmVydGljZXNbal0uY29tcG9uZW50ID09IGkpCisJICAgICAg YnJlYWs7CisJICBmb3IgKCsrajsgcGFydGl0aW9ucy0+aXRlcmF0ZSAoaiwg JnBhcnRpdGlvbik7ICsraikKKwkgICAgeworCSAgICAgIGlmIChwZy0+dmVy dGljZXNbal0uY29tcG9uZW50ICE9IGkpCisJCWNvbnRpbnVlOworCisJICAg ICAgaWYgKGZpcnN0LT50eXBlICE9IHBhcnRpdGlvbi0+dHlwZSkKKwkJewor CQkgIGJpdG1hcF9jbGVhcl9iaXQgKHNjY3NfdG9fbWVyZ2UsIGkpOworCQkg IGJyZWFrOworCQl9CisJICAgIH0KKwl9CisKKyAgICAgIC8qIEluaXRpYWxp emUgY2FsbGJhY2sgZGF0YSBmb3IgdHJhdmVyc2luZy4gICovCisgICAgICBj YmRhdGEuc2Njc190b19tZXJnZSA9IHNjY3NfdG9fbWVyZ2U7CisgICAgICBj YmRhdGEuYWxpYXNfZGRycyA9IGFsaWFzX2RkcnM7CisgICAgICBjYmRhdGEu dmVydGljZXNfY29tcG9uZW50ID0gWE5FV1ZFQyAoaW50LCBwZy0+bl92ZXJ0 aWNlcyk7CisgICAgICAvKiBSZWNvcmQgdGhlIGNvbXBvbmVudCBpbmZvcm1h dGlvbiB3aGljaCB3aWxsIGJlIGNvcnJ1cHRlZCBieSBuZXh0CisJIGdyYXBo IHNjYyBmaW5kaW5nIGNhbGwuICAqLworICAgICAgZm9yIChpID0gMDsgaSA8 IHBnLT5uX3ZlcnRpY2VzOyArK2kpCisJY2JkYXRhLnZlcnRpY2VzX2NvbXBv bmVudFtpXSA9IHBnLT52ZXJ0aWNlc1tpXS5jb21wb25lbnQ7CisKKyAgICAg IC8qIENvbGxlY3QgZGF0YSBkZXBlbmRlbmNlcyBmb3IgcnVudGltZSBhbGlh cyBjaGVja3MgdG8gYnJlYWsgU0NDcy4gICovCisgICAgICBpZiAoYml0bWFw X2NvdW50X2JpdHMgKHNjY3Nfd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29sbGVjdF9hbGlhc19kZHJzLCAmY2JkYXRhKTsKKwl9CisK KyAgICAgIC8qIEZvciBTQ0MgdGhhdCBkb2Vzbid0IG5lZWQgdG8gYmUgYnJv a2VuLCBtZXJnZSBpdC4gICovCisgICAgICBmb3IgKGkgPSAwOyBpIDwgbnVt X3NjY3M7ICsraSkKKwl7CisJICBpZiAoIWJpdG1hcF9iaXRfcCAoc2Njc190 b19tZXJnZSwgaSkpCisJICAgIGNvbnRpbnVlOworCisJICBmb3IgKGogPSAw OyBwYXJ0aXRpb25zLT5pdGVyYXRlIChqLCAmZmlyc3QpOyArK2opCisJICAg IGlmIChjYmRhdGEudmVydGljZXNfY29tcG9uZW50W2pdID09IGkpCisJICAg ICAgYnJlYWs7CisJICBmb3IgKCsrajsgcGFydGl0aW9ucy0+aXRlcmF0ZSAo aiwgJnBhcnRpdGlvbik7ICsraikKKwkgICAgeworCSAgICAgIHN0cnVjdCBw Z192ZGF0YSAqZGF0YTsKKworCSAgICAgIGlmIChjYmRhdGEudmVydGljZXNf Y29tcG9uZW50W2pdICE9IGkpCisJCWNvbnRpbnVlOworCisJICAgICAgcGFy dGl0aW9uX21lcmdlX2ludG8gKGZpcnN0LCBwYXJ0aXRpb24sIEZVU0VfU0FN RV9TQ0MpOworCSAgICAgICgqcGFydGl0aW9ucylbal0gPSBOVUxMOworCSAg ICAgIHBhcnRpdGlvbl9mcmVlIChwYXJ0aXRpb24pOworCSAgICAgIGRhdGEg PSAoc3RydWN0IHBnX3ZkYXRhICopcGctPnZlcnRpY2VzW2pdLmRhdGE7CisJ ICAgICAgZ2NjX2Fzc2VydCAoZGF0YS0+aWQgPT0gaik7CisJICAgICAgZGF0 YS0+cGFydGl0aW9uID0gTlVMTDsKKwkgICAgfQorCX0KKyAgICB9CisKKyAg c29ydF9wYXJ0aXRpb25zX2J5X3Bvc3Rfb3JkZXIgKHBnLCBwYXJ0aXRpb25z KTsKKyAgZnJlZV9wYXJ0aXRpb25fZ3JhcGhfdmRhdG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Fz X2RkcnM7CisgIHZlYzxkZHJfcD4gZGVwZW5kZW5jZXM7CisgIGRlcGVuZGVu Y2VzLmNyZWF0ZSAoMTApOworICBoYXNoX3RhYmxlPGRkcl9lbnRyeV9oYXNo ZXI+IGRkcl90YWJsZSAoMTUpOworICByZGdfY29tcHV0ZV9kYXRhX2RlcGVu ZGVuY2UgKHJkZywgbG9vcF9uZXN0LCAmZGF0YXJlZnMsCisJCQkgICAgICAg JmRlcGVuZGVuY2VzLCAmZGRyX3RhYmxlKTsKKworICAvKiBXZSBjYW4ndCBk byBydW50aW1lIGFsaWFzIGNoZWNrIGlmIG5pdGVyIGlzIHVua25vd24gZm9y IGxvb3AuICAqLworICB0cmVlIG5pdGVycyA9IG51bWJlcl9vZl9sYXRjaF9l eGVjdXRpb25zIChsb29wKTsKKyAgYm9vbCBydF9hbGlhc19jaGVja19wID0g KG5pdGVycyAhPSBOVUxMX1RSRUUgJiYgbml0ZXJzICE9IGNocmVjX2RvbnRf a25vdyk7CisKKyAgYXV0b19iaXRtYXAgc3RtdF9pbl9hbGxfcGFydGl0aW9u czsKICAgYXV0b192ZWM8c3RydWN0IHBhcnRpdGlvbiAqLCAzPiBwYXJ0aXRp b25zOwotICByZGdfYnVpbGRfcGFydGl0aW9ucyAocmRnLCBzdG10cywgJnBh cnRpdGlvbnMpOworICBiaXRtYXBfc2V0X3JhbmdlIChzdG10X2luX2FsbF9w YXJ0aXRpb25zLCAwLCByZGctPm5fdmVydGljZXMpOworICByZGdfYnVpbGRf cGFydGl0aW9ucyAocmRnLCAmZGRyX3RhYmxlLCBzdG10cywKKwkJCSZwYXJ0 aXRpb25zLCBzdG10X2luX2FsbF9wYXJ0aXRpb25zKTsKIAogICBhbnlfYnVp bHRpbiA9IGZhbHNlOwogICBGT1JfRUFDSF9WRUNfRUxUIChwYXJ0aXRpb25z LCBpLCBwYXJ0aXRpb24pCiAgICAgewotICAgICAgY2xhc3NpZnlfcGFydGl0 aW9uIChsb29wLCByZGcsIHBhcn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