[m-rev.] for review: redefinition of optimization levels 4 and 5.

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Apr 26 18:56:46 AEST 2001


For review by anyone.

Reorganize optimization levels 4 and 5, to use --no-lazy-code, --use-local-vars
and --delay-construct instead of --lazy-code and --optimize-value-number.

The new meanings of those optimization levels are the following:

	opt_level(4, _, [
		use_local_vars		-	bool(yes),
		inline_simple_threshold	-	int(8),
		inline_compound_threshold -	int(20),
		higher_order_size_limit -	int(30)
	]).

	opt_level(5, _, [
		optimize_repeat		-	int(5),
		delay_construct		-	bool(yes),
		inline_compound_threshold -	int(100),
		higher_order_size_limit -	int(40)
	]).

compiler/options.m:
	Implement the new scheme for optimization levels 4 and 5.

The new scheme is based on the following benchmark results, created by
makebatch and performed by speedtest; they measure the speed of the compiler
when compiled with different optimization flags. (The test command executed
was the same in every case.) As you can see, --use-local-vars with the default
eager code generator has better performance than --optimize-value-number and
--pred-value-number combined, with either the lazy or the eager code generator.
--delay-construct has no impact that can be distinguished from timing noise.
This is not surprising, since the file sizes strongly imply that it has
no effect on the compiler at all (it does speed up some small benchmarks,
e.g. query, a lot). This is why --use-local-vars is enabled at level 4 and
--delay-construct at level 5.

EXTRA_MCFLAGS = -O3
mercury_compile.01 15.660u 0.540s 0:20.23 80.0%	0+0k 0+0io 2843pf+0w
mercury_compile.01 15.430u 0.410s 0:15.83 100.0%	0+0k 0+0io 1324pf+0w
mercury_compile.01 15.470u 0.380s 0:15.84 100.0%	0+0k 0+0io 1324pf+0w
mercury_compile.01 15.490u 0.360s 0:15.84 100.0%	0+0k 0+0io 1324pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30
mercury_compile.02 15.620u 0.410s 0:16.03 100.0%	0+0k 0+0io 2619pf+0w
mercury_compile.02 15.270u 0.300s 0:15.57 100.0%	0+0k 0+0io 1310pf+0w
mercury_compile.02 15.190u 0.370s 0:15.56 100.0%	0+0k 0+0io 1310pf+0w
mercury_compile.02 15.210u 0.360s 0:15.57 100.0%	0+0k 0+0io 1310pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30 --delay-construct
mercury_compile.03 15.590u 0.440s 0:16.03 100.0%	0+0k 0+0io 2619pf+0w
mercury_compile.03 15.120u 0.430s 0:15.55 100.0%	0+0k 0+0io 1310pf+0w
mercury_compile.03 15.240u 0.320s 0:15.55 100.0%	0+0k 0+0io 1310pf+0w
mercury_compile.03 15.140u 0.420s 0:15.55 100.0%	0+0k 0+0io 1310pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30 --use-local-vars
mercury_compile.04 15.150u 0.550s 0:15.70 100.0%	0+0k 0+0io 2518pf+0w
mercury_compile.04 14.820u 0.430s 0:15.25 100.0%	0+0k 0+0io 1274pf+0w
mercury_compile.04 14.870u 0.370s 0:15.23 100.0%	0+0k 0+0io 1274pf+0w
mercury_compile.04 14.880u 0.350s 0:15.23 100.0%	0+0k 0+0io 1274pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30 --delay-construct --use-local-vars
mercury_compile.05 15.310u 0.380s 0:15.71 99.8%	0+0k 0+0io 2518pf+0w
mercury_compile.05 14.870u 0.380s 0:15.25 100.0%	0+0k 0+0io 1274pf+0w
mercury_compile.05 14.920u 0.310s 0:15.22 100.0%	0+0k 0+0io 1274pf+0w
mercury_compile.05 14.920u 0.300s 0:15.22 100.0%	0+0k 0+0io 1274pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30 --optimize-value-number
mercury_compile.06 15.630u 0.350s 0:15.98 100.0%	0+0k 0+0io 2601pf+0w
mercury_compile.06 15.100u 0.390s 0:15.49 100.0%	0+0k 0+0io 1305pf+0w
mercury_compile.06 15.090u 0.400s 0:15.49 100.0%	0+0k 0+0io 1305pf+0w
mercury_compile.06 15.110u 0.400s 0:15.50 100.0%	0+0k 0+0io 1305pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30 --lazy-code --optimize-value-number
mercury_compile.07 15.390u 0.440s 0:15.85 99.8%	0+0k 0+0io 2596pf+0w
mercury_compile.07 14.940u 0.390s 0:15.32 100.0%	0+0k 0+0io 1300pf+0w
mercury_compile.07 14.970u 0.350s 0:15.32 100.0%	0+0k 0+0io 1300pf+0w
mercury_compile.07 14.940u 0.390s 0:15.32 100.0%	0+0k 0+0io 1300pf+0w
EXTRA_MCFLAGS = -O3 --inline-simple-threshold 8 --inline-compound-threshold 20 --higher-order-size-limit 30 --lazy-code --optimize-value-number --optimize-vnrepeat 2 --pred-value-number
mercury_compile.08 15.670u 0.370s 0:17.76 90.3%	0+0k 0+0io 2626pf+0w
mercury_compile.08 14.960u 0.350s 0:15.31 100.0%	0+0k 0+0io 1319pf+0w
mercury_compile.08 14.990u 0.320s 0:15.30 100.0%	0+0k 0+0io 1319pf+0w
mercury_compile.08 14.940u 0.370s 0:15.31 100.0%	0+0k 0+0io 1319pf+0w

Zoltan.

Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.318
diff -u -b -r1.318 options.m
--- compiler/options.m	2001/04/24 03:59:01	1.318
+++ compiler/options.m	2001/04/26 03:18:12
@@ -1534,13 +1534,13 @@
 % Optimization level 4: apply optimizations which may have some
 % payoff even if they increase compilation time quite a bit
 
-% Currently this enables value_number
+% Currently this enables the use of local variables
 % and increases the inlining thresholds
 
 opt_level(4, _, [
-	delay_construct		-	bool(yes),
-	lazy_code		-	bool(yes),
-	optimize_value_number	-	bool(yes),
+	% lazy_code		-	bool(yes),
+	% optimize_value_number	-	bool(yes),
+	use_local_vars		-	bool(yes),
 	inline_simple_threshold	-	int(8),
 	inline_compound_threshold -	int(20),
 	higher_order_size_limit -	int(30)
@@ -1549,13 +1549,15 @@
 % Optimization level 5: apply optimizations which may have some
 % payoff even if they increase compilation time a lot
 
-% Currently this enables pred_value_number
-% and runs a second pass of value numbering
+% Currently this enables the search for construction unifications that can be
+% delayed past failing computations, allows more passes of the low-level
+% optimizations, and increases the inlining thresholds still further.
 
 opt_level(5, _, [
-	pred_value_number	-	bool(yes),
+	% pred_value_number	-	bool(yes),
+	% optimize_vnrepeat	-	int(2),
 	optimize_repeat		-	int(5),
-	optimize_vnrepeat	-	int(2),
+	delay_construct		-	bool(yes),
 	inline_compound_threshold -	int(100),
 	higher_order_size_limit -	int(40)
 ]).
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list