318 safe max RPM?

"Spin" is a relative word. If you run down the highway with 4.56's at 4500 RPM or more for an extended period, you might just run out of oil in the pan

But quick revs are not going to hurt if you have a decent oil pump

When I had the 340 in the old Landcruiser, with a little reground solid tappet cam, that thing ROUTINELY saw 7000 or a "touch more" in mudholes and stuff like that

You SHOULD worry about your top end. A broken spring, sucked valve, etc can end and engine just as quick as failed oil supply. So check the spring seat pressure, installed height, quality of your retainers, look for coil and rocker bind, and not knowing what cam/ piston combo you have, you might want to take a look at piston/ valve clearance

If this is "occasional" trips into the higher RPM realm such as street use, and you have a good IE "high volume" pump, I wouldn't worry too much

The LAST part of the question is, NOT "how high is safe", but rather "where should I be shifting it" for max acceleration? This is best done with either a dyno curve, and you can calculate transmission gear ratios, or by the use of a dash mount accelerometers, like "G force" which can generate a hp/ acceleration curve

Depending on what you have for a cam, you might just find that you will never want to shift it that high