Poor metaprogrammation performances

Poor metaprogrammation performances

Hi all,

I am using Intel C++ Composer 13 under Windows, and I would like to know if there were any options / or any plans in the future to make the recursives templates to compile in linear time.

If you consider the following very simple code:

template <int N>
struct fibo
{
    __forceinline float operator()(float a) const
    {
        return fibo<N-1>()(a) + fibo<N-2>()(a);
    }
};
template <>
struct fibo<1>
{
    __forceinline float operator()(float a) const
    {
        return a;
    }
};
template <>
struct fibo<0>
{
    __forceinline float operator()(float a) const
    {
        return a;
    }
};
float compute_fibo(float a)
{
    return fibo<16>()(a);
}

I have done some measurement (in basic /O2 compile) and:

* With Clang, compile time seems to be constant (tested up to fibo<256>) ~400ms
* With MS2012, compile times goes to ~400ms for fibo<1> to 175 seconds for fibo<20> not tested for greater values
* With icl, compile times goes to ~400ms for fibo<1> to 60 seconds for fibo<22> and for great values like fibo<32> i get out of memory errors (in 32 bits)

Note that even instantiating every function explicitely doesn't affect these performances.

As some code that use massive metaprogramming take very long while to compile, it would be super interesting that have this kind of code compiling in linear time (for instance by caching the instantation or doing like in gcc/clang).

I know that clang/gcc handle templates very differently and thus need the implementations to be more precise (more template and typename keywords required). Maybe icc acts the same and compile this without problems ? (I haven't tested)

Are there any plans in this directions ? Any hints for me ? (maybe hidden command flags)

Besr Regards,

Emmanuel

6 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

I just tried that code out on linux (icpc 14.0, 64 bit) with fibo<256> and it exhausted my 24 GB RAM in about 5 seconds flat (at which point I killed it before the kernel would chose to).

I have tried to generate the expected result

__forceinline float compute_fibo_0(float a) { return a; };
__forceinline float compute_fibo_1(float a) { return a; };
__forceinline float compute_fibo_2(float a) { return compute_fibo_1(a) + compute_fibo_0(a); };
__forceinline float compute_fibo_3(float a) { return compute_fibo_2(a) + compute_fibo_1(a); };
__forceinline float compute_fibo_4(float a) { return compute_fibo_3(a) + compute_fibo_2(a); };
__forceinline float compute_fibo_5(float a) { return compute_fibo_4(a) + compute_fibo_3(a); };
__forceinline float compute_fibo_6(float a) { return compute_fibo_5(a) + compute_fibo_4(a); };
__forceinline float compute_fibo_7(float a) { return compute_fibo_6(a) + compute_fibo_5(a); };
__forceinline float compute_fibo_8(float a) { return compute_fibo_7(a) + compute_fibo_6(a); };
__forceinline float compute_fibo_9(float a) { return compute_fibo_8(a) + compute_fibo_7(a); };
__forceinline float compute_fibo_10(float a) { return compute_fibo_9(a) + compute_fibo_8(a); };
__forceinline float compute_fibo_11(float a) { return compute_fibo_10(a) + compute_fibo_9(a); };
__forceinline float compute_fibo_12(float a) { return compute_fibo_11(a) + compute_fibo_10(a); };
__forceinline float compute_fibo_13(float a) { return compute_fibo_12(a) + compute_fibo_11(a); };
__forceinline float compute_fibo_14(float a) { return compute_fibo_13(a) + compute_fibo_12(a); };
__forceinline float compute_fibo_15(float a) { return compute_fibo_14(a) + compute_fibo_13(a); };
__forceinline float compute_fibo_16(float a) { return compute_fibo_15(a) + compute_fibo_14(a); };
__forceinline float compute_fibo_17(float a) { return compute_fibo_16(a) + compute_fibo_15(a); };
__forceinline float compute_fibo_18(float a) { return compute_fibo_17(a) + compute_fibo_16(a); };
__forceinline float compute_fibo_19(float a) { return compute_fibo_18(a) + compute_fibo_17(a); };
__forceinline float compute_fibo_20(float a) { return compute_fibo_19(a) + compute_fibo_18(a); };
__forceinline float compute_fibo_21(float a) { return compute_fibo_20(a) + compute_fibo_19(a); };
__forceinline float compute_fibo_22(float a) { return compute_fibo_21(a) + compute_fibo_20(a); };
__forceinline float compute_fibo_23(float a) { return compute_fibo_22(a) + compute_fibo_21(a); };
__forceinline float compute_fibo_24(float a) { return compute_fibo_23(a) + compute_fibo_22(a); };
__forceinline float compute_fibo_25(float a) { return compute_fibo_24(a) + compute_fibo_23(a); };
__forceinline float compute_fibo_26(float a) { return compute_fibo_25(a) + compute_fibo_24(a); };
__forceinline float compute_fibo_27(float a) { return compute_fibo_26(a) + compute_fibo_25(a); };
__forceinline float compute_fibo_28(float a) { return compute_fibo_27(a) + compute_fibo_26(a); };
__forceinline float compute_fibo_29(float a) { return compute_fibo_28(a) + compute_fibo_27(a); };
__forceinline float compute_fibo_30(float a) { return compute_fibo_29(a) + compute_fibo_28(a); };
__forceinline float compute_fibo_31(float a) { return compute_fibo_30(a) + compute_fibo_29(a); };
__forceinline float compute_fibo_32(float a) { return compute_fibo_31(a) + compute_fibo_30(a); };
__forceinline float compute_fibo_33(float a) { return compute_fibo_32(a) + compute_fibo_31(a); };
__forceinline float compute_fibo_34(float a) { return compute_fibo_33(a) + compute_fibo_32(a); };
__forceinline float compute_fibo_35(float a) { return compute_fibo_34(a) + compute_fibo_33(a); };
__forceinline float compute_fibo_36(float a) { return compute_fibo_35(a) + compute_fibo_34(a); };
__forceinline float compute_fibo_37(float a) { return compute_fibo_36(a) + compute_fibo_35(a); };
__forceinline float compute_fibo_38(float a) { return compute_fibo_37(a) + compute_fibo_36(a); };
__forceinline float compute_fibo_39(float a) { return compute_fibo_38(a) + compute_fibo_37(a); };
__forceinline float compute_fibo_40(float a) { return compute_fibo_39(a) + compute_fibo_38(a); };
__forceinline float compute_fibo_41(float a) { return compute_fibo_40(a) + compute_fibo_39(a); };
__forceinline float compute_fibo_42(float a) { return compute_fibo_41(a) + compute_fibo_40(a); };
__forceinline float compute_fibo_43(float a) { return compute_fibo_42(a) + compute_fibo_41(a); };
__forceinline float compute_fibo_44(float a) { return compute_fibo_43(a) + compute_fibo_42(a); };
__forceinline float compute_fibo_45(float a) { return compute_fibo_44(a) + compute_fibo_43(a); };
__forceinline float compute_fibo_46(float a) { return compute_fibo_45(a) + compute_fibo_44(a); };
__forceinline float compute_fibo_47(float a) { return compute_fibo_46(a) + compute_fibo_45(a); };
__forceinline float compute_fibo_48(float a) { return compute_fibo_47(a) + compute_fibo_46(a); };
__forceinline float compute_fibo_49(float a) { return compute_fibo_48(a) + compute_fibo_47(a); };
__forceinline float compute_fibo_50(float a) { return compute_fibo_49(a) + compute_fibo_48(a); };
__forceinline float compute_fibo_51(float a) { return compute_fibo_50(a) + compute_fibo_49(a); };
__forceinline float compute_fibo_52(float a) { return compute_fibo_51(a) + compute_fibo_50(a); };
__forceinline float compute_fibo_53(float a) { return compute_fibo_52(a) + compute_fibo_51(a); };
__forceinline float compute_fibo_54(float a) { return compute_fibo_53(a) + compute_fibo_52(a); };
__forceinline float compute_fibo_55(float a) { return compute_fibo_54(a) + compute_fibo_53(a); };
__forceinline float compute_fibo_56(float a) { return compute_fibo_55(a) + compute_fibo_54(a); };
__forceinline float compute_fibo_57(float a) { return compute_fibo_56(a) + compute_fibo_55(a); };
__forceinline float compute_fibo_58(float a) { return compute_fibo_57(a) + compute_fibo_56(a); };
__forceinline float compute_fibo_59(float a) { return compute_fibo_58(a) + compute_fibo_57(a); };
__forceinline float compute_fibo_60(float a) { return compute_fibo_59(a) + compute_fibo_58(a); };
__forceinline float compute_fibo_61(float a) { return compute_fibo_60(a) + compute_fibo_59(a); };
__forceinline float compute_fibo_62(float a) { return compute_fibo_61(a) + compute_fibo_60(a); };
__forceinline float compute_fibo_63(float a) { return compute_fibo_62(a) + compute_fibo_61(a); };
__forceinline float compute_fibo_64(float a) { return compute_fibo_63(a) + compute_fibo_62(a); };
__forceinline float compute_fibo_65(float a) { return compute_fibo_64(a) + compute_fibo_63(a); };
__forceinline float compute_fibo_66(float a) { return compute_fibo_65(a) + compute_fibo_64(a); };
__forceinline float compute_fibo_67(float a) { return compute_fibo_66(a) + compute_fibo_65(a); };
__forceinline float compute_fibo_68(float a) { return compute_fibo_67(a) + compute_fibo_66(a); };
__forceinline float compute_fibo_69(float a) { return compute_fibo_68(a) + compute_fibo_67(a); };
__forceinline float compute_fibo_70(float a) { return compute_fibo_69(a) + compute_fibo_68(a); };
__forceinline float compute_fibo_71(float a) { return compute_fibo_70(a) + compute_fibo_69(a); };
__forceinline float compute_fibo_72(float a) { return compute_fibo_71(a) + compute_fibo_70(a); };
__forceinline float compute_fibo_73(float a) { return compute_fibo_72(a) + compute_fibo_71(a); };
__forceinline float compute_fibo_74(float a) { return compute_fibo_73(a) + compute_fibo_72(a); };
__forceinline float compute_fibo_75(float a) { return compute_fibo_74(a) + compute_fibo_73(a); };
__forceinline float compute_fibo_76(float a) { return compute_fibo_75(a) + compute_fibo_74(a); };
__forceinline float compute_fibo_77(float a) { return compute_fibo_76(a) + compute_fibo_75(a); };
__forceinline float compute_fibo_78(float a) { return compute_fibo_77(a) + compute_fibo_76(a); };
__forceinline float compute_fibo_79(float a) { return compute_fibo_78(a) + compute_fibo_77(a); };
__forceinline float compute_fibo_80(float a) { return compute_fibo_79(a) + compute_fibo_78(a); };
__forceinline float compute_fibo_81(float a) { return compute_fibo_80(a) + compute_fibo_79(a); };
__forceinline float compute_fibo_82(float a) { return compute_fibo_81(a) + compute_fibo_80(a); };
__forceinline float compute_fibo_83(float a) { return compute_fibo_82(a) + compute_fibo_81(a); };
__forceinline float compute_fibo_84(float a) { return compute_fibo_83(a) + compute_fibo_82(a); };
__forceinline float compute_fibo_85(float a) { return compute_fibo_84(a) + compute_fibo_83(a); };
__forceinline float compute_fibo_86(float a) { return compute_fibo_85(a) + compute_fibo_84(a); };
__forceinline float compute_fibo_87(float a) { return compute_fibo_86(a) + compute_fibo_85(a); };
__forceinline float compute_fibo_88(float a) { return compute_fibo_87(a) + compute_fibo_86(a); };
__forceinline float compute_fibo_89(float a) { return compute_fibo_88(a) + compute_fibo_87(a); };
__forceinline float compute_fibo_90(float a) { return compute_fibo_89(a) + compute_fibo_88(a); };
__forceinline float compute_fibo_91(float a) { return compute_fibo_90(a) + compute_fibo_89(a); };
__forceinline float compute_fibo_92(float a) { return compute_fibo_91(a) + compute_fibo_90(a); };
__forceinline float compute_fibo_93(float a) { return compute_fibo_92(a) + compute_fibo_91(a); };
__forceinline float compute_fibo_94(float a) { return compute_fibo_93(a) + compute_fibo_92(a); };
__forceinline float compute_fibo_95(float a) { return compute_fibo_94(a) + compute_fibo_93(a); };
__forceinline float compute_fibo_96(float a) { return compute_fibo_95(a) + compute_fibo_94(a); };
__forceinline float compute_fibo_97(float a) { return compute_fibo_96(a) + compute_fibo_95(a); };
__forceinline float compute_fibo_98(float a) { return compute_fibo_97(a) + compute_fibo_96(a); };
__forceinline float compute_fibo_99(float a) { return compute_fibo_98(a) + compute_fibo_97(a); };
__forceinline float compute_fibo_100(float a) { return compute_fibo_99(a) + compute_fibo_98(a); };
__forceinline float compute_fibo_101(float a) { return compute_fibo_100(a) + compute_fibo_99(a); };
__forceinline float compute_fibo_102(float a) { return compute_fibo_101(a) + compute_fibo_100(a); };
__forceinline float compute_fibo_103(float a) { return compute_fibo_102(a) + compute_fibo_101(a); };
__forceinline float compute_fibo_104(float a) { return compute_fibo_103(a) + compute_fibo_102(a); };
__forceinline float compute_fibo_105(float a) { return compute_fibo_104(a) + compute_fibo_103(a); };
__forceinline float compute_fibo_106(float a) { return compute_fibo_105(a) + compute_fibo_104(a); };
__forceinline float compute_fibo_107(float a) { return compute_fibo_106(a) + compute_fibo_105(a); };
__forceinline float compute_fibo_108(float a) { return compute_fibo_107(a) + compute_fibo_106(a); };
__forceinline float compute_fibo_109(float a) { return compute_fibo_108(a) + compute_fibo_107(a); };
__forceinline float compute_fibo_110(float a) { return compute_fibo_109(a) + compute_fibo_108(a); };
__forceinline float compute_fibo_111(float a) { return compute_fibo_110(a) + compute_fibo_109(a); };
__forceinline float compute_fibo_112(float a) { return compute_fibo_111(a) + compute_fibo_110(a); };
__forceinline float compute_fibo_113(float a) { return compute_fibo_112(a) + compute_fibo_111(a); };
__forceinline float compute_fibo_114(float a) { return compute_fibo_113(a) + compute_fibo_112(a); };
__forceinline float compute_fibo_115(float a) { return compute_fibo_114(a) + compute_fibo_113(a); };
__forceinline float compute_fibo_116(float a) { return compute_fibo_115(a) + compute_fibo_114(a); };
__forceinline float compute_fibo_117(float a) { return compute_fibo_116(a) + compute_fibo_115(a); };
__forceinline float compute_fibo_118(float a) { return compute_fibo_117(a) + compute_fibo_116(a); };
__forceinline float compute_fibo_119(float a) { return compute_fibo_118(a) + compute_fibo_117(a); };
__forceinline float compute_fibo_120(float a) { return compute_fibo_119(a) + compute_fibo_118(a); };
__forceinline float compute_fibo_121(float a) { return compute_fibo_120(a) + compute_fibo_119(a); };
__forceinline float compute_fibo_122(float a) { return compute_fibo_121(a) + compute_fibo_120(a); };
__forceinline float compute_fibo_123(float a) { return compute_fibo_122(a) + compute_fibo_121(a); };
__forceinline float compute_fibo_124(float a) { return compute_fibo_123(a) + compute_fibo_122(a); };
__forceinline float compute_fibo_125(float a) { return compute_fibo_124(a) + compute_fibo_123(a); };
__forceinline float compute_fibo_126(float a) { return compute_fibo_125(a) + compute_fibo_124(a); };
__forceinline float compute_fibo_127(float a) { return compute_fibo_126(a) + compute_fibo_125(a); };
__forceinline float compute_fibo_128(float a) { return compute_fibo_127(a) + compute_fibo_126(a); };
__forceinline float compute_fibo_129(float a) { return compute_fibo_128(a) + compute_fibo_127(a); };
__forceinline float compute_fibo_130(float a) { return compute_fibo_129(a) + compute_fibo_128(a); };
__forceinline float compute_fibo_131(float a) { return compute_fibo_130(a) + compute_fibo_129(a); };
__forceinline float compute_fibo_132(float a) { return compute_fibo_131(a) + compute_fibo_130(a); };
__forceinline float compute_fibo_133(float a) { return compute_fibo_132(a) + compute_fibo_131(a); };
__forceinline float compute_fibo_134(float a) { return compute_fibo_133(a) + compute_fibo_132(a); };
__forceinline float compute_fibo_135(float a) { return compute_fibo_134(a) + compute_fibo_133(a); };
__forceinline float compute_fibo_136(float a) { return compute_fibo_135(a) + compute_fibo_134(a); };
__forceinline float compute_fibo_137(float a) { return compute_fibo_136(a) + compute_fibo_135(a); };
__forceinline float compute_fibo_138(float a) { return compute_fibo_137(a) + compute_fibo_136(a); };
__forceinline float compute_fibo_139(float a) { return compute_fibo_138(a) + compute_fibo_137(a); };
__forceinline float compute_fibo_140(float a) { return compute_fibo_139(a) + compute_fibo_138(a); };
__forceinline float compute_fibo_141(float a) { return compute_fibo_140(a) + compute_fibo_139(a); };
__forceinline float compute_fibo_142(float a) { return compute_fibo_141(a) + compute_fibo_140(a); };
__forceinline float compute_fibo_143(float a) { return compute_fibo_142(a) + compute_fibo_141(a); };
__forceinline float compute_fibo_144(float a) { return compute_fibo_143(a) + compute_fibo_142(a); };
__forceinline float compute_fibo_145(float a) { return compute_fibo_144(a) + compute_fibo_143(a); };
__forceinline float compute_fibo_146(float a) { return compute_fibo_145(a) + compute_fibo_144(a); };
__forceinline float compute_fibo_147(float a) { return compute_fibo_146(a) + compute_fibo_145(a); };
__forceinline float compute_fibo_148(float a) { return compute_fibo_147(a) + compute_fibo_146(a); };
__forceinline float compute_fibo_149(float a) { return compute_fibo_148(a) + compute_fibo_147(a); };
__forceinline float compute_fibo_150(float a) { return compute_fibo_149(a) + compute_fibo_148(a); };
__forceinline float compute_fibo_151(float a) { return compute_fibo_150(a) + compute_fibo_149(a); };
__forceinline float compute_fibo_152(float a) { return compute_fibo_151(a) + compute_fibo_150(a); };
__forceinline float compute_fibo_153(float a) { return compute_fibo_152(a) + compute_fibo_151(a); };
__forceinline float compute_fibo_154(float a) { return compute_fibo_153(a) + compute_fibo_152(a); };
__forceinline float compute_fibo_155(float a) { return compute_fibo_154(a) + compute_fibo_153(a); };
__forceinline float compute_fibo_156(float a) { return compute_fibo_155(a) + compute_fibo_154(a); };
__forceinline float compute_fibo_157(float a) { return compute_fibo_156(a) + compute_fibo_155(a); };
__forceinline float compute_fibo_158(float a) { return compute_fibo_157(a) + compute_fibo_156(a); };
__forceinline float compute_fibo_159(float a) { return compute_fibo_158(a) + compute_fibo_157(a); };
__forceinline float compute_fibo_160(float a) { return compute_fibo_159(a) + compute_fibo_158(a); };
__forceinline float compute_fibo_161(float a) { return compute_fibo_160(a) + compute_fibo_159(a); };
__forceinline float compute_fibo_162(float a) { return compute_fibo_161(a) + compute_fibo_160(a); };
__forceinline float compute_fibo_163(float a) { return compute_fibo_162(a) + compute_fibo_161(a); };
__forceinline float compute_fibo_164(float a) { return compute_fibo_163(a) + compute_fibo_162(a); };
__forceinline float compute_fibo_165(float a) { return compute_fibo_164(a) + compute_fibo_163(a); };
__forceinline float compute_fibo_166(float a) { return compute_fibo_165(a) + compute_fibo_164(a); };
__forceinline float compute_fibo_167(float a) { return compute_fibo_166(a) + compute_fibo_165(a); };
__forceinline float compute_fibo_168(float a) { return compute_fibo_167(a) + compute_fibo_166(a); };
__forceinline float compute_fibo_169(float a) { return compute_fibo_168(a) + compute_fibo_167(a); };
__forceinline float compute_fibo_170(float a) { return compute_fibo_169(a) + compute_fibo_168(a); };
__forceinline float compute_fibo_171(float a) { return compute_fibo_170(a) + compute_fibo_169(a); };
__forceinline float compute_fibo_172(float a) { return compute_fibo_171(a) + compute_fibo_170(a); };
__forceinline float compute_fibo_173(float a) { return compute_fibo_172(a) + compute_fibo_171(a); };
__forceinline float compute_fibo_174(float a) { return compute_fibo_173(a) + compute_fibo_172(a); };
__forceinline float compute_fibo_175(float a) { return compute_fibo_174(a) + compute_fibo_173(a); };
__forceinline float compute_fibo_176(float a) { return compute_fibo_175(a) + compute_fibo_174(a); };
__forceinline float compute_fibo_177(float a) { return compute_fibo_176(a) + compute_fibo_175(a); };
__forceinline float compute_fibo_178(float a) { return compute_fibo_177(a) + compute_fibo_176(a); };
__forceinline float compute_fibo_179(float a) { return compute_fibo_178(a) + compute_fibo_177(a); };
__forceinline float compute_fibo_180(float a) { return compute_fibo_179(a) + compute_fibo_178(a); };
__forceinline float compute_fibo_181(float a) { return compute_fibo_180(a) + compute_fibo_179(a); };
__forceinline float compute_fibo_182(float a) { return compute_fibo_181(a) + compute_fibo_180(a); };
__forceinline float compute_fibo_183(float a) { return compute_fibo_182(a) + compute_fibo_181(a); };
__forceinline float compute_fibo_184(float a) { return compute_fibo_183(a) + compute_fibo_182(a); };
__forceinline float compute_fibo_185(float a) { return compute_fibo_184(a) + compute_fibo_183(a); };
__forceinline float compute_fibo_186(float a) { return compute_fibo_185(a) + compute_fibo_184(a); };
__forceinline float compute_fibo_187(float a) { return compute_fibo_186(a) + compute_fibo_185(a); };
__forceinline float compute_fibo_188(float a) { return compute_fibo_187(a) + compute_fibo_186(a); };
__forceinline float compute_fibo_189(float a) { return compute_fibo_188(a) + compute_fibo_187(a); };
__forceinline float compute_fibo_190(float a) { return compute_fibo_189(a) + compute_fibo_188(a); };
__forceinline float compute_fibo_191(float a) { return compute_fibo_190(a) + compute_fibo_189(a); };
__forceinline float compute_fibo_192(float a) { return compute_fibo_191(a) + compute_fibo_190(a); };
__forceinline float compute_fibo_193(float a) { return compute_fibo_192(a) + compute_fibo_191(a); };
__forceinline float compute_fibo_194(float a) { return compute_fibo_193(a) + compute_fibo_192(a); };
__forceinline float compute_fibo_195(float a) { return compute_fibo_194(a) + compute_fibo_193(a); };
__forceinline float compute_fibo_196(float a) { return compute_fibo_195(a) + compute_fibo_194(a); };
__forceinline float compute_fibo_197(float a) { return compute_fibo_196(a) + compute_fibo_195(a); };
__forceinline float compute_fibo_198(float a) { return compute_fibo_197(a) + compute_fibo_196(a); };
__forceinline float compute_fibo_199(float a) { return compute_fibo_198(a) + compute_fibo_197(a); };
__forceinline float compute_fibo_200(float a) { return compute_fibo_199(a) + compute_fibo_198(a); };
__forceinline float compute_fibo_201(float a) { return compute_fibo_200(a) + compute_fibo_199(a); };
__forceinline float compute_fibo_202(float a) { return compute_fibo_201(a) + compute_fibo_200(a); };
__forceinline float compute_fibo_203(float a) { return compute_fibo_202(a) + compute_fibo_201(a); };
__forceinline float compute_fibo_204(float a) { return compute_fibo_203(a) + compute_fibo_202(a); };
__forceinline float compute_fibo_205(float a) { return compute_fibo_204(a) + compute_fibo_203(a); };
__forceinline float compute_fibo_206(float a) { return compute_fibo_205(a) + compute_fibo_204(a); };
__forceinline float compute_fibo_207(float a) { return compute_fibo_206(a) + compute_fibo_205(a); };
__forceinline float compute_fibo_208(float a) { return compute_fibo_207(a) + compute_fibo_206(a); };
__forceinline float compute_fibo_209(float a) { return compute_fibo_208(a) + compute_fibo_207(a); };
__forceinline float compute_fibo_210(float a) { return compute_fibo_209(a) + compute_fibo_208(a); };
__forceinline float compute_fibo_211(float a) { return compute_fibo_210(a) + compute_fibo_209(a); };
__forceinline float compute_fibo_212(float a) { return compute_fibo_211(a) + compute_fibo_210(a); };
__forceinline float compute_fibo_213(float a) { return compute_fibo_212(a) + compute_fibo_211(a); };
__forceinline float compute_fibo_214(float a) { return compute_fibo_213(a) + compute_fibo_212(a); };
__forceinline float compute_fibo_215(float a) { return compute_fibo_214(a) + compute_fibo_213(a); };
__forceinline float compute_fibo_216(float a) { return compute_fibo_215(a) + compute_fibo_214(a); };
__forceinline float compute_fibo_217(float a) { return compute_fibo_216(a) + compute_fibo_215(a); };
__forceinline float compute_fibo_218(float a) { return compute_fibo_217(a) + compute_fibo_216(a); };
__forceinline float compute_fibo_219(float a) { return compute_fibo_218(a) + compute_fibo_217(a); };
__forceinline float compute_fibo_220(float a) { return compute_fibo_219(a) + compute_fibo_218(a); };
__forceinline float compute_fibo_221(float a) { return compute_fibo_220(a) + compute_fibo_219(a); };
__forceinline float compute_fibo_222(float a) { return compute_fibo_221(a) + compute_fibo_220(a); };
__forceinline float compute_fibo_223(float a) { return compute_fibo_222(a) + compute_fibo_221(a); };
__forceinline float compute_fibo_224(float a) { return compute_fibo_223(a) + compute_fibo_222(a); };
__forceinline float compute_fibo_225(float a) { return compute_fibo_224(a) + compute_fibo_223(a); };
__forceinline float compute_fibo_226(float a) { return compute_fibo_225(a) + compute_fibo_224(a); };
__forceinline float compute_fibo_227(float a) { return compute_fibo_226(a) + compute_fibo_225(a); };
__forceinline float compute_fibo_228(float a) { return compute_fibo_227(a) + compute_fibo_226(a); };
__forceinline float compute_fibo_229(float a) { return compute_fibo_228(a) + compute_fibo_227(a); };
__forceinline float compute_fibo_230(float a) { return compute_fibo_229(a) + compute_fibo_228(a); };
__forceinline float compute_fibo_231(float a) { return compute_fibo_230(a) + compute_fibo_229(a); };
__forceinline float compute_fibo_232(float a) { return compute_fibo_231(a) + compute_fibo_230(a); };
__forceinline float compute_fibo_233(float a) { return compute_fibo_232(a) + compute_fibo_231(a); };
__forceinline float compute_fibo_234(float a) { return compute_fibo_233(a) + compute_fibo_232(a); };
__forceinline float compute_fibo_235(float a) { return compute_fibo_234(a) + compute_fibo_233(a); };
__forceinline float compute_fibo_236(float a) { return compute_fibo_235(a) + compute_fibo_234(a); };
__forceinline float compute_fibo_237(float a) { return compute_fibo_236(a) + compute_fibo_235(a); };
__forceinline float compute_fibo_238(float a) { return compute_fibo_237(a) + compute_fibo_236(a); };
__forceinline float compute_fibo_239(float a) { return compute_fibo_238(a) + compute_fibo_237(a); };
__forceinline float compute_fibo_240(float a) { return compute_fibo_239(a) + compute_fibo_238(a); };
__forceinline float compute_fibo_241(float a) { return compute_fibo_240(a) + compute_fibo_239(a); };
__forceinline float compute_fibo_242(float a) { return compute_fibo_241(a) + compute_fibo_240(a); };
__forceinline float compute_fibo_243(float a) { return compute_fibo_242(a) + compute_fibo_241(a); };
__forceinline float compute_fibo_244(float a) { return compute_fibo_243(a) + compute_fibo_242(a); };
__forceinline float compute_fibo_245(float a) { return compute_fibo_244(a) + compute_fibo_243(a); };
__forceinline float compute_fibo_246(float a) { return compute_fibo_245(a) + compute_fibo_244(a); };
__forceinline float compute_fibo_247(float a) { return compute_fibo_246(a) + compute_fibo_245(a); };
__forceinline float compute_fibo_248(float a) { return compute_fibo_247(a) + compute_fibo_246(a); };
__forceinline float compute_fibo_249(float a) { return compute_fibo_248(a) + compute_fibo_247(a); };
__forceinline float compute_fibo_250(float a) { return compute_fibo_249(a) + compute_fibo_248(a); };
__forceinline float compute_fibo_251(float a) { return compute_fibo_250(a) + compute_fibo_249(a); };
__forceinline float compute_fibo_252(float a) { return compute_fibo_251(a) + compute_fibo_250(a); };
__forceinline float compute_fibo_253(float a) { return compute_fibo_252(a) + compute_fibo_251(a); };
__forceinline float compute_fibo_254(float a) { return compute_fibo_253(a) + compute_fibo_252(a); };
__forceinline float compute_fibo_255(float a) { return compute_fibo_254(a) + compute_fibo_253(a); };

It is a little bit faster but my computer is out of memory when i try to compile "compute_fibo_32" and upper...

Clang++ is the only one amonst gcc 4.8, visual 2012, intel 13, having no problem compiling this.

Seeing as how the template only has a chance of functioning when N is const, declare it as template<const int N>.

It compiles fine here with fibo < 64 >()(a)
(no spaces, spaces are hack for the forum editor)

Jim Dempsey

www.quickthreadprogramming.com

Citation :

jimdempseyatthecove a écrit :

Seeing as how the template only has a chance of functioning when N is const, declare it as template<const int N>.

It compiles fine here with fibo < 64 >()(a)
(no spaces, spaces are hack for the forum editor)

Jim Dempsey

int argument of templates are always immediates, so i don't get what the const gives more to the template definition...

in any case i tried without improvement.

I should add, this is in Debug build, x32, inlining was not forced. Same on x64 (ICC 2011 Update 9)

www.quickthreadprogramming.com

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui