-ecc inhibits CF in SCCFprf_modarray5.sac - need to separate shape vector from array
|Created on||Apr 09, 2010 18:06|
Created an attachment (id=686) source code to reproduce fault I've made some improvements (I hope) in constant folding when -ecc/-check c are active. The CF unit test SCCFprf_modarray5.sac is intended to eliminate a sel/modarray pair of operations. This is of fundamental importance in operations such as loop fusion/array contraction. When the attached is compiled ( in my version of code with -ecc: (rev 16776:16792:MODIFIED)), we end up with this IL: _flat_1 = true; _flat_0 = 1; one = _MAIN::id( _flat_0, _flat_1); _ivexp_92_is = 0; _isaa_54_one = _dim_A_( one); _isaa_55_one = _shape_A_( one); _isaa_56_one = _saabind_( _isaa_54_one, _isaa_55_one, one); _idc_38, _icc_27_pred = _type_constraint_( int, _isaa_56_one); _icc_28 = _add_SxS_( _idc_38, _flat_0); _flat_2 = _afterguard_( _icc_28, _icc_27_pred); cltwo = _MAIN::id( _flat_2, _flat_1); _isaa_57_cltwo = _dim_A_( cltwo); _isaa_58_cltwo = _shape_A_( cltwo); _isaa_59_cltwo = _saabind_( _isaa_57_cltwo, _isaa_58_cltwo, cltwo); _flat_5 = 5; five = _MAIN::id( _flat_5, _flat_1); _isaa_60_five = _dim_A_( five); _isaa_61_five = _shape_A_( five); _isaa_62_five = _saabind_( _isaa_60_five, _isaa_61_five, five); _idc_39, _icc_29_pred = _type_constraint_( int, _isaa_62_five); _flat_7 = [:int]; _idc_40, _icc_30_pred = _shape_matches_dim_VxA_( _flat_7, _isaa_59_cltwo); _icc_33 = _modarray_AxVxS_( _isaa_59_cltwo, _flat_7, _idc_39); x3 = _afterguard_( _icc_33, _icc_30_pred, _icc_29_pred); _idc_44, _icc_34_pred = _shape_matches_dim_VxA_( _flat_7, x3); _icc_37 = _afterguard_( _idc_39, _icc_30_pred, _icc_29_pred); z = _afterguard_( _icc_37, _icc_34_pred); _esd_50 = -5; z__SSA0_1 = _add_SxS_( z, _esd_50); return( z__SSA0_1); Note that the function result does not refer to s3 nor to _icc_33, but they are still with us, because of the presence of guards. This suggests to me that we might want to change _shape_matches_dim_VxA_() into something like this: temps = _idx_shape_sel_( _flat_7); tempd = _dim_A_( x3); ..._val_matches_val_SxS_(_flat_7, temps, tempd); What this would do is to eliminate the need to materialize the value of x3. With any luck, other optimizations would remove the references to x3 and _Flat_7, and allow them to be removed from the picture as well.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information