In prior work we proposed Zeroploit, a transform that duplicates code, specializes one path assuming certain key program operands, called versioning variables, are zero, and leaves the other path unspecialized. Dynamically, depending on the versioning variable’s value, either the specialized fast path or the default slow path will execute. We evaluated Zeroploit with hand-optimized codes in that work.
In this paper, we present PGZ, a completely automated, profile-guided compiler approach for Zeroploit. Our compiler automatically determines which versioning variables or combinations thereof are profitable, and determines the code region to duplicate and specialize. PGZ's heuristic takes operand zero value probabilities as input and it then uses classical techniques such as constant folding and dead-code elimination to estimate the potential savings of specializing a versioning variable. PGZ transforms profitable candidates, yielding an average speedup of 21.2% for targeted shader programs, and an average frame-rate speedup of 4.4% across a collection of modern gaming applications on an NVIDIA GeForce RTX 2080 GPU.
Copyright by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept, ACM Inc., fax +1 (212) 869-0481, or firstname.lastname@example.org. The definitive version of this paper can be found at ACM's Digital Library http://www.acm.org/dl/.