The spark plug of an opposed-piston two-stroke (OP2S) gasoline engine is arranged on the side wall of the cylinder liner, far from the center of the combustion chamber; the ignition core of the mixture is offset, the flame propagation distance is increased, the combustion duration is prolonged, and the knock tendency is severe. In this paper, a quasi-dimensional two-zone combustion model is used in GT-Power software to establish a thermodynamic process simulation model and a knock prediction model is included to analyze the effect and matching of the compression ratio, ignition timing, and other thermodynamic process parameters on the knock intensity and engine performance. The extended coherent flame model combustion model is coupled with the Huh-Gosman spray model in AVL-Fire software, and the An B knock model is used to establish an in-cylinder combustion model and analyze the flame propagation and the knock response rate of the flat and pit piston during the combustion process. With an increase of the compression ratio, the temperature and pressure of the mixture in the combustion chamber increase at the time of ignition, which leads to the knocking combustion in the cylinder. With an increase of the ignition advance angle, the in-cylinder pressure and temperature increase rapidly, which increases the likelihood of knocking combustion. In comparison with the pit piston combustion chamber, the flame propagation speed of the flat piston combustion chamber is relatively slow, which increases the knock tendency. The results show that lowering the compression ratio and delaying the ignition can reduce the incylinder knock tendency by setting a compression ratio of 10.5 and an ignition advance angle of 20°CA. When the pit piston is used to organize the squish and inverse squish before and after the inner dead center, the flame propagation process can be promoted. The knock response rate of pit piston is 24.7% lower than that of flat top piston.