Jump to page: 1 24  
Page
Thread overview
Cryptic bug for DMD v2.087.x
Aug 12, 2019
Peter Jacobs
Aug 12, 2019
Nicholas Wilson
Aug 12, 2019
Peter Jacobs
Aug 12, 2019
Nicholas Wilson
Aug 12, 2019
Peter Jacobs
Aug 12, 2019
Seb
Aug 13, 2019
FeepingCreature
Aug 13, 2019
Mike Parker
Aug 13, 2019
Seb
Aug 13, 2019
Vladimir Panteleev
Aug 13, 2019
Jonathan M Davis
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
matheus
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
Seb
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
Vladimir Panteleev
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
Vladimir Panteleev
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
Vladimir Panteleev
Aug 14, 2019
Peter Jacobs
Aug 14, 2019
Seb
Aug 19, 2019
Peter Jacobs
Aug 19, 2019
ag0aep6g
Aug 19, 2019
Daniel Kozak
Aug 19, 2019
Daniel Kozak
Aug 19, 2019
Simen Kjærås
Aug 19, 2019
Daniel Kozak
Aug 19, 2019
Simen Kjærås
Aug 12, 2019
Peter Jacobs
Aug 12, 2019
Nicholas Wilson
Aug 12, 2019
Guillaume Piolat
Aug 12, 2019
Peter Jacobs
August 12, 2019
We have a flow simulation code (http://cfcfd.mechmining.uq.edu.au/eilmer/) that fails to build optimized with DMD v2.087.0 or v2.087.1.  The cryptic message at the end of the attempt to build is:
  tym = x14
  makefile:414: recipe for target 'e4shared' failed
  make: *** [e4shared] Illegal instruction (core dumped)
and the compiler flags are:
  dmd -w -O -release -inline -boundscheck=off -dip1008 ...

The build is successful if we omit the -O flag.

In contrast, we have successful optimized builds for DMD 2.086.1 and LDC 1.17.0-beta1.

I can provide more details but I was thinking that the "tym = x14" might already mean something to someone familiar with the insides of DMD.

Best regards,
Peter J.

August 12, 2019
On Monday, 12 August 2019 at 01:45:24 UTC, Peter Jacobs wrote:
> We have a flow simulation code (http://cfcfd.mechmining.uq.edu.au/eilmer/) that fails to build optimized with DMD v2.087.0 or v2.087.1.  The cryptic message at the end of the attempt to build is:
>   tym = x14
>   makefile:414: recipe for target 'e4shared' failed
>   make: *** [e4shared] Illegal instruction (core dumped)
> and the compiler flags are:
>   dmd -w -O -release -inline -boundscheck=off -dip1008 ...
>
> The build is successful if we omit the -O flag.
>
> In contrast, we have successful optimized builds for DMD 2.086.1 and LDC 1.17.0-beta1.
>
> I can provide more details but I was thinking that the "tym = x14" might already mean something to someone familiar with the insides of DMD.
>
> Best regards,
> Peter J.

That looks like https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L816-L817 or https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L716-L717 (or maybe https://github.com/dlang/dmd/blob/8623bbbebe35b9a320ba20e521a6c0ee51a780ac/src/dmd/backend/evalu8.d#L905 )

Can you run it in a debugger and provide a stack trace to confirm?

tym = 0x14 corresponds to real (== 80 bit fp), which is best avoided if possible as it is very slow.

Also, silly question, why would you use DMD, with optimisations, for cfd? surely your productivity is runtime bottlenecked?
August 12, 2019
On Monday, 12 August 2019 at 01:45:24 UTC, Peter Jacobs wrote:
> We have a flow simulation code (http://cfcfd.mechmining.uq.edu.au/eilmer/) that fails to build optimized with DMD v2.087.0 or v2.087.1.  The cryptic message at the end of the attempt to build is:
>   tym = x14
>   makefile:414: recipe for target 'e4shared' failed
>   make: *** [e4shared] Illegal instruction (core dumped)
> and the compiler flags are:
>   dmd -w -O -release -inline -boundscheck=off -dip1008 ...
>
> The build is successful if we omit the -O flag.
>
> In contrast, we have successful optimized builds for DMD 2.086.1 and LDC 1.17.0-beta1.
>
> I can provide more details but I was thinking that the "tym = x14" might already mean something to someone familiar with the insides of DMD.
>
> Best regards,
> Peter J.

Hello,

This is a DMD backend bug. If you could spend the few hours (much less with habit) needed to reduce it to a small piece of code that still triggers the bug, it would really help the community.

What I do is just delete code and get to that small reproducible example with manual dichotomy.
August 12, 2019
On Monday, 12 August 2019 at 04:01:28 UTC, Nicholas Wilson wrote:
> On Monday, 12 August 2019 at 01:45:24 UTC, Peter Jacobs wrote:
>> We have a flow simulation code (http://cfcfd.mechmining.uq.edu.au/eilmer/) that fails to build optimized with DMD v2.087.0 or v2.087.1.  The cryptic message at the end of the attempt to build is:
>>   tym = x14
>>   makefile:414: recipe for target 'e4shared' failed
>>   make: *** [e4shared] Illegal instruction (core dumped)
>> and the compiler flags are:
>>   dmd -w -O -release -inline -boundscheck=off -dip1008 ...
>>
>> The build is successful if we omit the -O flag.
>>
>> In contrast, we have successful optimized builds for DMD 2.086.1 and LDC 1.17.0-beta1.
>>
>> I can provide more details but I was thinking that the "tym = x14" might already mean something to someone familiar with the insides of DMD.
>>
>> Best regards,
>> Peter J.
>
> That looks like https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L816-L817 or https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L716-L717 (or maybe https://github.com/dlang/dmd/blob/8623bbbebe35b9a320ba20e521a6c0ee51a780ac/src/dmd/backend/evalu8.d#L905 )
>
> Can you run it in a debugger and provide a stack trace to confirm?
>
> tym = 0x14 corresponds to real (== 80 bit fp), which is best avoided if possible as it is very slow.
>
> Also, silly question, why would you use DMD, with optimisations, for cfd? surely your productivity is runtime bottlenecked?

Nicholas, thank you for looking.  Below is the transcript of compiling from within gdb.

peterj@helmholtz ~/dgd/src/eilmer $ make FLAVOUR=fast
sed -e 's/PUT_REVISION_STRING_HERE/23bdf96ea6d1+ 2522+ default tip/' main.d > \
	main_with_rev_string.d
gdb --args dmd -w -O -release -inline -boundscheck=off -version=flavour_fast -dip1008 -I.. -I../nm -I../util -I../geom -I../grid_utils -I../extern/gzip -version=multi_species_gas -version=multi_T_gas -version=MHD -version=komega -ofe4shared \
	-version=tecplot_unavailable \
	main_with_rev_string.d \
	simcore.d fileutil.d json_helper.d fvcore.d fvcell.d fvvertex.d fvinterface.d fluxcalc.d onedinterp.d flowgradients.d lsqinterp.d limiters.d conservedquantities.d flowstate.d globalconfig.d globaldata.d fluidblock.d sfluidblock.d ufluidblock.d gas_solid_interface.d flowsolution.d grid_motion.d shock_fitting_moving_grid.d history.d loads.d special_block_init.d mass_diffusion.d tecplot_writer.d luaglobalconfig.d lua_helper.d luaflowsolution.d luaflowstate.d user_defined_source_terms.d postprocess.d \
	bc/package.d bc/boundary_condition.d bc/ghost_cell_effect/package.d bc/ghost_cell_effect/ghost_cell.d bc/ghost_cell_effect/internal_copy_then_reflect.d bc/ghost_cell_effect/flow_state_copy.d bc/ghost_cell_effect/flow_state_copy_from_profile.d bc/ghost_cell_effect/extrapolate_copy.d bc/ghost_cell_effect/fixed_p.d bc/ghost_cell_effect/fixed_pt.d bc/ghost_cell_effect/from_stagnation.d bc/ghost_cell_effect/full_face_copy.d bc/ghost_cell_effect/mapped_cell_copy.d bc/user_defined_effects.d bc/boundary_flux_effect.d bc/boundary_cell_effect.d bc/boundary_interface_effect.d solid/solidbc.d solid/solidblock.d solid/solid_boundary_flux_effect.d solid/solid_boundary_interface_effect.d solid/solid_loose_coupling_update.d solid/ssolidblock.d solid/solidfvcell.d solid/solidfvinterface.d solid/solidfvvertex.d solid/solidprops.d solid/solidsolution.d solid/solid_udf_source_terms.d solid/luasolidprops.d ../geom/package.d ../geom/geometry_exception.d ../geom/elements/package.d ../geom/elements/nomenclature.d ../geom/elements/vector3.d ../geom/elements/properties.d ../geom/elements/projection.d ../geom/gpath/package.d ../geom/gpath/path.d ../geom/gpath/line.d ../geom/gpath/arc.d ../geom/gpath/helix.d ../geom/gpath/bezier.d ../geom/gpath/polynomial.d ../geom/gpath/polyline.d ../geom/gpath/svgpath.d ../geom/gpath/modifiedpath.d ../geom/gpath/gpath_utils.d ../geom/surface/package.d ../geom/surface/parametricsurface.d ../geom/surface/coonspatch.d ../geom/surface/aopatch.d ../geom/surface/channelpatch.d ../geom/surface/sweptpathpatch.d ../geom/surface/meshpatch.d ../geom/surface/subrangedsurface.d ../geom/surface/bezierpatch.d ../geom/surface/beziertrianglepatch.d ../geom/volume/package.d ../geom/volume/parametricvolume.d ../geom/volume/tfivolume.d ../geom/volume/slabvolume.d ../geom/volume/wedgevolume.d ../geom/volume/sweptsurfacevolume.d ../geom/volume/twosurfacevolume.d ../geom/volume/meshvolume.d ../geom/volume/subrangedvolume.d ../geom/grid/package.d ../geom/grid/grid.d ../geom/grid/sgrid.d ../geom/grid/usgrid.d ../geom/grid/paver.d ../geom/grid/paver2d.d ../geom/misc/package.d ../geom/misc/univariatefunctions.d ../geom/misc/svg.d ../geom/misc/sketch.d ../geom/luawrap/package.d ../geom/luawrap/luaunifunction.d ../geom/luawrap/luageom.d ../geom/luawrap/luagpath.d ../geom/luawrap/luagpath_utils.d ../geom/luawrap/luasurface.d ../geom/luawrap/luavolume.d ../geom/luawrap/luagrid.d ../geom/luawrap/luasgrid.d ../geom/luawrap/luausgrid.d ../geom/luawrap/luasketch.d ../grid_utils/grid_deform.d  \
	../gas/package.d ../gas/co2gas.d ../gas/co2gas_sw.d ../gas/gas_model.d ../gas/gas_state.d ../gas/init_gas_model.d ../gas/ideal_gas.d ../gas/ideal_helium.d ../gas/cubic_gas.d ../gas/cea_gas.d ../gas/physical_constants.d ../gas/sf6virial.d ../gas/therm_perf_gas.d ../gas/very_viscous_air.d ../gas/uniform_lut.d ../gas/uniform_lut_plus_ideal.d ../gas/adaptive_lut_CEA.d ../gas/ideal_air_proxy.d ../gas/powers_aslam_gas.d ../gas/two_temperature_reacting_argon.d ../gas/ideal_dissociating_gas.d ../gas/two_temperature_air.d ../gas/two_temperature_nitrogen.d ../gas/vib_specific_nitrogen.d ../gas/fuel_air_mix.d ../gas/equilibrium_gas.d ../gas/ideal_air_fortran.o ../gas/steam.d ../gas/pseudo_species_gas.d ../gas/pseudo_species.d ../gas/electronically_specific_gas.d ../gas/electronic_species.d ../gas/two_temperature_gasgiant.d ../gas/thermo/cea_thermo_curves.d ../gas/thermo/evt_eos.d ../gas/thermo/perf_gas_mix_eos.d ../gas/thermo/pvt_eos.d ../gas/thermo/therm_perf_gas_mix_eos.d ../gas/diffusion/cea_therm_cond.d ../gas/diffusion/cea_viscosity.d ../gas/diffusion/chemkin_therm_cond.d ../gas/diffusion/chemkin_viscosity.d ../gas/diffusion/sutherland_therm_cond.d ../gas/diffusion/sutherland_viscosity.d ../gas/diffusion/therm_cond.d ../gas/diffusion/viscosity.d ../gas/diffusion/wilke_mixing_therm_cond.d ../gas/diffusion/wilke_mixing_viscosity.d ../gas/diffusion/gasgiant_transport_properties.d ../extern/gzip/gzip.d \
	../util/lua.d ../util/lua_service.d ../util/msg_service.d ../nm/package.d ../nm/number.d ../nm/complex.d ../nm/bbla.d ../nm/bdfLU.d ../nm/bracketing.d ../nm/brent.d ../nm/gaussquad.d ../nm/linesearch.d ../nm/nelmin.d ../nm/newtoncotes.d ../nm/ridder.d ../nm/rungekutta.d ../nm/rsla.d ../nm/smla.d ../nm/tree_patch.d ../nm/univariate_lut.d \
	../kinetics/package.d ../kinetics/thermochemical_reactor.d ../kinetics/init_thermochemical_reactor.d ../kinetics/chemistry_update.d ../kinetics/electronic_update.d ../kinetics/electronically_specific_kinetics.d ../kinetics/ideal_dissociating_gas_kinetics.d ../kinetics/fuel_air_mix_kinetics.d ../kinetics/powers_aslam_kinetics.d ../kinetics/rate_constant.d ../kinetics/reaction.d ../kinetics/reaction_mechanism.d ../kinetics/two_temperature_air_kinetics.d ../kinetics/two_temperature_argon_kinetics.d ../kinetics/two_temperature_nitrogen_kinetics.d ../kinetics/vib_specific_nitrogen_kinetics.d ../kinetics/two_temperature_gasgiant_kinetics.d ../gas/luagas_model.d ../kinetics/luathermochemical_reactor.d ../kinetics/luachemistry_update.d ../kinetics/luaelectronically_specific_kinetics.d ../kinetics/luareaction_mechanism.d ../kinetics/luatwo_temperature_air_kinetics.d ../kinetics/luavib_specific_nitrogen_kinetics.d \
	../gasdyn/gasflowexception.d ../gasdyn/idealgasflow.d ../gasdyn/luaidealgasflow.d ../gasdyn/gasflow.d ../gasdyn/luagasflow.d ../nm/luabbla.d  \
	-L-L../../extern/lua-5.1.4/lib  -L-llua -L-ldl
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from dmd...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/dmd -w -O -release -inline -boundscheck=off -version=flavour_fast -dip1008 -I.. -I../nm -I../util -I../geom -I../grid_utils -I../extern/gzip -version=multi_species_gas -version=multi_T_gas -version=MHD -version=komega -ofe4shared -version=tecplot_unavailable main_with_rev_string.d simcore.d fileutil.d json_helper.d fvcore.d fvcell.d fvvertex.d fvinterface.d fluxcalc.d onedinterp.d flowgradients.d lsqinterp.d limiters.d conservedquantities.d flowstate.d globalconfig.d globaldata.d fluidblock.d sfluidblock.d ufluidblock.d gas_solid_interface.d flowsolution.d grid_motion.d shock_fitting_moving_grid.d history.d loads.d special_block_init.d mass_diffusion.d tecplot_writer.d luaglobalconfig.d lua_helper.d luaflowsolution.d luaflowstate.d user_defined_source_terms.d postprocess.d bc/package.d bc/boundary_condition.d bc/ghost_cell_effect/package.d bc/ghost_cell_effect/ghost_cell.d bc/ghost_cell_effect/internal_copy_then_reflect.d bc/ghost_cell_effect/flow_state_copy.d bc/ghost_cell_effect/flow_state_copy_from_profile.d bc/ghost_cell_effect/extrapolate_copy.d bc/ghost_cell_effect/fixed_p.d bc/ghost_cell_effect/fixed_pt.d bc/ghost_cell_effect/from_stagnation.d bc/ghost_cell_effect/full_face_copy.d bc/ghost_cell_effect/mapped_cell_copy.d bc/user_defined_effects.d bc/boundary_flux_effect.d bc/boundary_cell_effect.d bc/boundary_interface_effect.d solid/solidbc.d solid/solidblock.d solid/solid_boundary_flux_effect.d solid/solid_boundary_interface_effect.d solid/solid_loose_coupling_update.d solid/ssolidblock.d solid/solidfvcell.d solid/solidfvinterface.d solid/solidfvvertex.d solid/solidprops.d solid/solidsolution.d solid/solid_udf_source_terms.d solid/luasolidprops.d ../geom/package.d ../geom/geometry_exception.d ../geom/elements/package.d ../geom/elements/nomenclature.d ../geom/elements/vector3.d ../geom/elements/properties.d ../geom/elements/projection.d ../geom/gpath/package.d ../geom/gpath/path.d ../geom/gpath/line.d ../geom/gpath/arc.d ../geom/gpath/helix.d ../geom/gpath/bezier.d ../geom/gpath/polynomial.d ../geom/gpath/polyline.d ../geom/gpath/svgpath.d ../geom/gpath/modifiedpath.d ../geom/gpath/gpath_utils.d ../geom/surface/package.d ../geom/surface/parametricsurface.d ../geom/surface/coonspatch.d ../geom/surface/aopatch.d ../geom/surface/channelpatch.d ../geom/surface/sweptpathpatch.d ../geom/surface/meshpatch.d ../geom/surface/subrangedsurface.d ../geom/surface/bezierpatch.d ../geom/surface/beziertrianglepatch.d ../geom/volume/package.d ../geom/volume/parametricvolume.d ../geom/volume/tfivolume.d ../geom/volume/slabvolume.d ../geom/volume/wedgevolume.d ../geom/volume/sweptsurfacevolume.d ../geom/volume/twosurfacevolume.d ../geom/volume/meshvolume.d ../geom/volume/subrangedvolume.d ../geom/grid/package.d ../geom/grid/grid.d ../geom/grid/sgrid.d ../geom/grid/usgrid.d ../geom/grid/paver.d ../geom/grid/paver2d.d ../geom/misc/package.d ../geom/misc/univariatefunctions.d ../geom/misc/svg.d ../geom/misc/sketch.d ../geom/luawrap/package.d ../geom/luawrap/luaunifunction.d ../geom/luawrap/luageom.d ../geom/luawrap/luagpath.d ../geom/luawrap/luagpath_utils.d ../geom/luawrap/luasurface.d ../geom/luawrap/luavolume.d ../geom/luawrap/luagrid.d ../geom/luawrap/luasgrid.d ../geom/luawrap/luausgrid.d ../geom/luawrap/luasketch.d ../grid_utils/grid_deform.d ../gas/package.d ../gas/co2gas.d ../gas/co2gas_sw.d ../gas/gas_model.d ../gas/gas_state.d ../gas/init_gas_model.d ../gas/ideal_ga---Type <return> to continue, or q <return> to quit---
s.d ../gas/ideal_helium.d ../gas/cubic_gas.d ../gas/cea_gas.d ../gas/physical_constants.d ../gas/sf6virial.d ../gas/therm_perf_gas.d ../gas/very_viscous_air.d ../gas/uniform_lut.d ../gas/uniform_lut_plus_ideal.d ../gas/adaptive_lut_CEA.d ../gas/ideal_air_proxy.d ../gas/powers_aslam_gas.d ../gas/two_temperature_reacting_argon.d ../gas/ideal_dissociating_gas.d ../gas/two_temperature_air.d ../gas/two_temperature_nitrogen.d ../gas/vib_specific_nitrogen.d ../gas/fuel_air_mix.d ../gas/equilibrium_gas.d ../gas/ideal_air_fortran.o ../gas/steam.d ../gas/pseudo_species_gas.d ../gas/pseudo_species.d ../gas/electronically_specific_gas.d ../gas/electronic_species.d ../gas/two_temperature_gasgiant.d ../gas/thermo/cea_thermo_curves.d ../gas/thermo/evt_eos.d ../gas/thermo/perf_gas_mix_eos.d ../gas/thermo/pvt_eos.d ../gas/thermo/therm_perf_gas_mix_eos.d ../gas/diffusion/cea_therm_cond.d ../gas/diffusion/cea_viscosity.d ../gas/diffusion/chemkin_therm_cond.d ../gas/diffusion/chemkin_viscosity.d ../gas/diffusion/sutherland_therm_cond.d ../gas/diffusion/sutherland_viscosity.d ../gas/diffusion/therm_cond.d ../gas/diffusion/viscosity.d ../gas/diffusion/wilke_mixing_therm_cond.d ../gas/diffusion/wilke_mixing_viscosity.d ../gas/diffusion/gasgiant_transport_properties.d ../extern/gzip/gzip.d ../util/lua.d ../util/lua_service.d ../util/msg_service.d ../nm/package.d ../nm/number.d ../nm/complex.d ../nm/bbla.d ../nm/bdfLU.d ../nm/bracketing.d ../nm/brent.d ../nm/gaussquad.d ../nm/linesearch.d ../nm/nelmin.d ../nm/newtoncotes.d ../nm/ridder.d ../nm/rungekutta.d ../nm/rsla.d ../nm/smla.d ../nm/tree_patch.d ../nm/univariate_lut.d ../kinetics/package.d ../kinetics/thermochemical_reactor.d ../kinetics/init_thermochemical_reactor.d ../kinetics/chemistry_update.d ../kinetics/electronic_update.d ../kinetics/electronically_specific_kinetics.d ../kinetics/ideal_dissociating_gas_kinetics.d ../kinetics/fuel_air_mix_kinetics.d ../kinetics/powers_aslam_kinetics.d ../kinetics/rate_constant.d ../kinetics/reaction.d ../kinetics/reaction_mechanism.d ../kinetics/two_temperature_air_kinetics.d ../kinetics/two_temperature_argon_kinetics.d ../kinetics/two_temperature_nitrogen_kinetics.d ../kinetics/vib_specific_nitrogen_kinetics.d ../kinetics/two_temperature_gasgiant_kinetics.d ../gas/luagas_model.d ../kinetics/luathermochemical_reactor.d ../kinetics/luachemistry_update.d ../kinetics/luaelectronically_specific_kinetics.d ../kinetics/luareaction_mechanism.d ../kinetics/luatwo_temperature_air_kinetics.d ../kinetics/luavib_specific_nitrogen_kinetics.d ../gasdyn/gasflowexception.d ../gasdyn/idealgasflow.d ../gasdyn/luaidealgasflow.d ../gasdyn/gasflow.d ../gasdyn/luagasflow.d ../nm/luabbla.d -L-L../../extern/lua-5.1.4/lib -L-llua -L-ldl
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
tym = x14

Program received signal SIGILL, Illegal instruction.
0x000000000081df07 in xmmload(unsigned int, bool) ()
(gdb) backtrace
#0  0x000000000081df07 in xmmload(unsigned int, bool) ()
#1  0x000000000080b13c in fixresult87(CodeBuilder&, elem*, unsigned int, unsigned int*) ()
#2  0x0000000000819362 in neg87(CodeBuilder&, elem*, unsigned int*) ()
#3  0x00000000008440b0 in cdneg(CodeBuilder&, elem*, unsigned int*) ()
#4  0x00000000008256fb in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#5  0x00000000008977d2 in cdcnvt(CodeBuilder&, elem*, unsigned int*) ()
#6  0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#7  0x00000000008977d2 in cdcnvt(CodeBuilder&, elem*, unsigned int*) ()
#8  0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#9  0x0000000000819324 in neg87(CodeBuilder&, elem*, unsigned int*) ()
#10 0x00000000008446e6 in cdabs(CodeBuilder&, elem*, unsigned int*) ()
#11 0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#12 0x00000000008977d2 in cdcnvt(CodeBuilder&, elem*, unsigned int*) ()
#13 0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#14 0x000000000081c949 in orthxmm(CodeBuilder&, elem*, unsigned int*) ()
#15 0x0000000000838805 in cdmul(CodeBuilder&, elem*, unsigned int*) ()
#16 0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#17 0x0000000000825b44 in scodelem(CodeBuilder&, elem*, unsigned int*, unsigned int, bool) ()
#18 0x000000000081cc7d in xmmeq(CodeBuilder&, elem*, unsigned int, elem*, elem*, unsigned int*) ()
#19 0x000000000088f57f in cdeq(CodeBuilder&, elem*, unsigned int*) ()
#20 0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#21 0x000000000081c949 in orthxmm(CodeBuilder&, elem*, unsigned int*) ()
#22 0x0000000000894d2b in cdcmp(CodeBuilder&, elem*, unsigned int*) ()
---Type <return> to continue, or q <return> to quit---
#23 0x00000000008257e3 in codelem(CodeBuilder&, elem*, unsigned int*, unsigned int) ()
#24 0x00000000008276d0 in logexp(CodeBuilder&, elem*, int, unsigned int, code*) ()
#25 0x0000000000847daa in outblkexitcode(CodeBuilder&, block*, int&, char const*, Symbol**, unsigned int) ()
#26 0x0000000000823854 in blcodgen(block*) ()
#27 0x00000000008214f0 in codgen(Symbol*) ()
#28 0x00000000007ee2ef in writefunc2(Symbol*) ()
#29 0x00000000007eddcf in writefunc(Symbol*) ()
#30 0x00000000007a6c2f in FuncDeclaration_toObjFile(FuncDeclaration*, bool) ()
#31 0x00000000007bb2e6 in toObjFile::ToObjFile::visit(FuncDeclaration*) ()
#32 0x000000000068d871 in FuncDeclaration::accept(Visitor*) ()
#33 0x00000000007bb271 in toObjFile(Dsymbol*, bool) ()
#34 0x00000000007a4dae in genObjFile(Module*, bool) ()
#35 0x0000000000709462 in _D3dmd4mars7tryMainFmPPxaKSQz7globals5ParamZi ()
#36 0x000000000070a6bc in D main ()
(gdb)

August 12, 2019
On Monday, 12 August 2019 at 04:01:28 UTC, Nicholas Wilson wrote:
> On Monday, 12 August 2019 at 01:45:24 UTC, Peter Jacobs wrote:
>> We have a flow simulation code (http://cfcfd.mechmining.uq.edu.au/eilmer/) that fails to build optimized with DMD v2.087.0 or v2.087.1.  The cryptic message at the end of the attempt to build is:
>>   tym = x14
>>   makefile:414: recipe for target 'e4shared' failed
>>   make: *** [e4shared] Illegal instruction (core dumped)
>> and the compiler flags are:
>>   dmd -w -O -release -inline -boundscheck=off -dip1008 ...
>>
>> The build is successful if we omit the -O flag.
>>
>> In contrast, we have successful optimized builds for DMD 2.086.1 and LDC 1.17.0-beta1.
>>
>> I can provide more details but I was thinking that the "tym = x14" might already mean something to someone familiar with the insides of DMD.
>>
>> Best regards,
>> Peter J.
>
> That looks like https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L816-L817 or https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L716-L717 (or maybe https://github.com/dlang/dmd/blob/8623bbbebe35b9a320ba20e521a6c0ee51a780ac/src/dmd/backend/evalu8.d#L905 )
>
> Can you run it in a debugger and provide a stack trace to confirm?
>
> tym = 0x14 corresponds to real (== 80 bit fp), which is best avoided if possible as it is very slow.
>
> Also, silly question, why would you use DMD, with optimisations, for cfd? surely your productivity is runtime bottlenecked?

Nicholas,
Not a silly question.  Yes, the run time is dominated by crunching numbers but most of the core of the code is @nogc and we find that there is little run-time difference between DMD64 and LDC generated executables.  It turns out that, for the complex-numbers plus optimized flavour of the code, we need to use the ldc compiler because of another (longer term) bug.  I thought that I would report the recent change in compiler behaviour while it was fresh.  For development runs, which is mostly what I do, I generally find the debug build and profiling provided by dmd to be convenient.  The other members of our CFD group who do large parallel calculations mainly build with ldmd2.

As for the 80-bit FP nature of the problem, I don't deliberately use 80-bit variables.  Is there a way to easily identify where I force the use of 80-bit variables upon the compiler?  I expect that operations with temporary results that stay within the floating-point registers will probably use 80-bit values but I cannot think of any places where I have wanted to retain 80-bits when storing data in my variables.

Peter J.





August 12, 2019
On Monday, 12 August 2019 at 11:08:50 UTC, Peter Jacobs wrote:
> Nicholas, thank you for looking.  Below is the transcript of compiling from within gdb.
> [...]
>> Program received signal SIGILL, Illegal instruction.
> 0x000000000081df07 in xmmload(unsigned int, bool) ()
> (gdb) backtrace
> #0  0x000000000081df07 in xmmload(unsigned int, bool) ()

Thanks, that corresponds to https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L716-L717.

So it would appear that you are trying (apparently successfully with debug DMD (and LDC(?)) to use `real` with xmm somehow???
I can't really help anymore without a reduced test case.



August 12, 2019
On Monday, 12 August 2019 at 10:34:25 UTC, Guillaume Piolat wrote:
>
> Hello,
>
> This is a DMD backend bug. If you could spend the few hours (much less with habit) needed to reduce it to a small piece of code that still triggers the bug, it would really help the community.
>
> What I do is just delete code and get to that small reproducible example with manual dichotomy.

Agreed that this would be a good thing to do, but I have to get up early for class in the morning.  I will have to leave it for a week-end activity.


August 12, 2019
On Monday, 12 August 2019 at 11:30:58 UTC, Nicholas Wilson wrote:
> On Monday, 12 August 2019 at 11:08:50 UTC, Peter Jacobs wrote:
>> Nicholas, thank you for looking.  Below is the transcript of compiling from within gdb.
>> [...]
>>> Program received signal SIGILL, Illegal instruction.
>> 0x000000000081df07 in xmmload(unsigned int, bool) ()
>> (gdb) backtrace
>> #0  0x000000000081df07 in xmmload(unsigned int, bool) ()
>
> Thanks, that corresponds to https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L716-L717.
>
> So it would appear that you are trying (apparently successfully with debug DMD (and LDC(?)) to use `real` with xmm somehow???
> I can't really help anymore without a reduced test case.

OK, I will see what I can do about a test case.  Also, I will go looking for places where we* might have used real variables or values.  I can think of the use of PI from the math module, for example.

Cheers,
Peter J.

* There are a few of us writing various parts of the flow solver code.

August 12, 2019
On Monday, 12 August 2019 at 11:27:13 UTC, Peter Jacobs wrote:
> Nicholas,
> Not a silly question.  Yes, the run time is dominated by crunching numbers but most of the core of the code is @nogc and we find that there is little run-time difference between DMD64 and LDC generated executables.

That _is_ odd. usually LDC and GDC will run circles around DMD, especially with LTO/PGO. Doubly so for loop/math heavy stuff like cfd, where the code gets vectorised and unrolled very aggressively.

>  It turns out that, for the complex-numbers plus optimized flavour of the code, we need to use the ldc compiler because of another (longer term) bug.  I thought that I would report the recent change in compiler behaviour while it was fresh.  For development runs, which is mostly what I do, I generally find the debug build and profiling provided by dmd to be convenient.

Fair enough.

> The other members of our CFD group who do large parallel calculations mainly build with ldmd2.

makes sense.

> As for the 80-bit FP nature of the problem, I don't deliberately use 80-bit variables.  Is there a way to easily identify where I force the use of 80-bit variables upon the compiler?  I expect that operations with temporary results that stay within the floating-point registers will probably use 80-bit values but I cannot think of any places where I have wanted to retain 80-bits when storing data in my variables.
>
> Peter J.

They crop up in DMD's intrinsics for transcendentals which the standard library uses for non CTFE. I've tried to kill off in the past but without success. LDC defers to LLVM, which does things sensibly. There isn't a `-vreal` switch though its probably not too hard to implement.
August 12, 2019
On Monday, 12 August 2019 at 11:47:17 UTC, Peter Jacobs wrote:
> On Monday, 12 August 2019 at 11:30:58 UTC, Nicholas Wilson wrote:
>> On Monday, 12 August 2019 at 11:08:50 UTC, Peter Jacobs wrote:
>>> Nicholas, thank you for looking.  Below is the transcript of compiling from within gdb.
>>> [...]
>>>> Program received signal SIGILL, Illegal instruction.
>>> 0x000000000081df07 in xmmload(unsigned int, bool) ()
>>> (gdb) backtrace
>>> #0  0x000000000081df07 in xmmload(unsigned int, bool) ()
>>
>> Thanks, that corresponds to https://github.com/dlang/dmd/blob/eda232a9f72b482c92cefb27a4321afc0aedbb5c/src/dmd/backend/cgxmm.d#L716-L717.
>>
>> So it would appear that you are trying (apparently successfully with debug DMD (and LDC(?)) to use `real` with xmm somehow???
>> I can't really help anymore without a reduced test case.
>
> OK, I will see what I can do about a test case.  Also, I will go looking for places where we* might have used real variables or values.  I can think of the use of PI from the math module, for example.
>
> Cheers,
> Peter J.
>
> * There are a few of us writing various parts of the flow solver code.

FYI DustMite has been created _exactly_ for this purpose. It's even bundled with the official DMD releases.

https://github.com/CyberShadow/DustMite/wiki


1) Copy all project sources in fresh directory
2) Run dustmite with a tester to check whether the bug can still be observed.
Here:

---
dustmite fresh-dir 'dmd -O (your normal invocation) 2>&1 | grep -qF "tym = 14"'
---
« First   ‹ Prev
1 2 3 4