I can't answer for every line but here you go;
. First, I think frame_delay doesn't work at 144Hz, only 60.
. Second, if you've picked the Windows 7/8/10 build you don't need to write 'video d3d', leave on 'auto' as the build uses d3d9ex as default anyway.
. Third, you don't have to set frame_delay from either the mame.ini nor a number of specific ones anymore, and there's simpler than benching, now you can adjust during gameplay with the new dedicated slider.
Play a game, press TAB go to the sliders menu, set a level of frame delay, play and do it again until it's stable (F11 speed meter always at 100% during a run) it'll automatically save, for every game independently.
Setting it to 1 guarantees you have only 1 frame of input lag on top of the game, 5 means there's only 0.5 frames, and 9 means there's only like 1.6 ms of delay remaining between you and the game,
but it is very CPU intensive so usually works better on the lighter games, and with frame_delay remember the higher your panel resolution the higher the workload also, with my setup (check the sig) there's few games with which I can afford more than 7.
. Fourth, if using frame_delay even stable gives you some tearing at the top of the screen, you'll still need to create dedicated ini's for each game in which you'll write a fitting value of vsync_offset.
like for instance: romname.ini
vsync_offset 50
Increase the value (100, 150, 300, 450 etc) to make the line go up the screen until it disappears, decrease if you see it reappear at the bottom.
Put all your dedicated .ini's in the INI folder of course.
It's a bit tedious since you have to stop the game and go back editing the .ini file until it's right.
Note: using HLSL draws some more juice and therefore usually needs higher offset than without. If it requires too much offset and still doesn't work to eliminate the tearing, then drop frame_delay one level and do it again.